diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-01 01:36:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-02 16:57:07 +0200 |
commit | 76148b27f7501bac061992136852be4303370c8d (patch) | |
tree | fc0559253e833c9252fa14ebaec5321d88bfb4e8 /server/helpers/middlewares/abuses.ts | |
parent | 5ed25fb76e920dac364cb9ef46f14ec4bd372949 (diff) | |
download | PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.gz PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.zst PeerTube-76148b27f7501bac061992136852be4303370c8d.zip |
refactor API errors to standard error format
Diffstat (limited to 'server/helpers/middlewares/abuses.ts')
-rw-r--r-- | server/helpers/middlewares/abuses.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/helpers/middlewares/abuses.ts b/server/helpers/middlewares/abuses.ts index c53bd9efd..f0b1caba8 100644 --- a/server/helpers/middlewares/abuses.ts +++ b/server/helpers/middlewares/abuses.ts | |||
@@ -6,8 +6,10 @@ async function doesAbuseExist (abuseId: number | string, res: Response) { | |||
6 | const abuse = await AbuseModel.loadByIdWithReporter(parseInt(abuseId + '', 10)) | 6 | const abuse = await AbuseModel.loadByIdWithReporter(parseInt(abuseId + '', 10)) |
7 | 7 | ||
8 | if (!abuse) { | 8 | if (!abuse) { |
9 | res.status(HttpStatusCode.NOT_FOUND_404) | 9 | res.fail({ |
10 | .json({ error: 'Abuse not found' }) | 10 | status: HttpStatusCode.NOT_FOUND_404, |
11 | message: 'Abuse not found' | ||
12 | }) | ||
11 | 13 | ||
12 | return false | 14 | return false |
13 | } | 15 | } |