diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2019-02-22 11:46:58 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-22 11:46:58 +0900 |
| commit | 2756f553c68082342a784ef716c62da6cea6f3ca (patch) | |
| tree | 1e0364ca9ddc1fd88e311f0687746f44e007effd /src/server/api/endpoints/i/update_widget.ts | |
| parent | Update CHANGELOG.md (diff) | |
| download | misskey-2756f553c68082342a784ef716c62da6cea6f3ca.tar.gz misskey-2756f553c68082342a784ef716c62da6cea6f3ca.tar.bz2 misskey-2756f553c68082342a784ef716c62da6cea6f3ca.zip | |
Improve error handling of API (#4345)
* wip
* wip
* wip
* Update attached_notes.ts
* wip
* Refactor
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update call.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* :v:
* Fix
Diffstat (limited to 'src/server/api/endpoints/i/update_widget.ts')
| -rw-r--r-- | src/server/api/endpoints/i/update_widget.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/server/api/endpoints/i/update_widget.ts b/src/server/api/endpoints/i/update_widget.ts index e3e91c1f08..67d342278d 100644 --- a/src/server/api/endpoints/i/update_widget.ts +++ b/src/server/api/endpoints/i/update_widget.ts @@ -19,8 +19,8 @@ export const meta = { } }; -export default define(meta, (ps, user) => new Promise(async (res, rej) => { - if (ps.id == null && ps.data == null) return rej('you need to set id and data params if home param unset'); +export default define(meta, async (ps, user) => { + if (ps.id == null && ps.data == null) throw new Error('you need to set id and data params if home param unset'); let widget; @@ -81,8 +81,8 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { id: ps.id, data: ps.data }); - res(); + return; } else { - rej('widget not found'); + throw new Error('widget not found'); } -})); +}); |