diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/controllers/api/search.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r-- | server/controllers/api/search.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 6e2d11d93..353fd171b 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts | |||
@@ -6,6 +6,7 @@ import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/vi | |||
6 | import { AccountBlocklistModel } from '@server/models/account/account-blocklist' | 6 | import { AccountBlocklistModel } from '@server/models/account/account-blocklist' |
7 | import { getServerActor } from '@server/models/application/application' | 7 | import { getServerActor } from '@server/models/application/application' |
8 | import { ServerBlocklistModel } from '@server/models/server/server-blocklist' | 8 | import { ServerBlocklistModel } from '@server/models/server/server-blocklist' |
9 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
9 | import { ResultList, Video, VideoChannel } from '@shared/models' | 10 | import { ResultList, Video, VideoChannel } from '@shared/models' |
10 | import { SearchTargetQuery } from '@shared/models/search/search-target-query.model' | 11 | import { SearchTargetQuery } from '@shared/models/search/search-target-query.model' |
11 | import { VideoChannelsSearchQuery, VideosSearchQuery } from '../../../shared/models/search' | 12 | import { VideoChannelsSearchQuery, VideosSearchQuery } from '../../../shared/models/search' |
@@ -99,7 +100,7 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e | |||
99 | } catch (err) { | 100 | } catch (err) { |
100 | logger.warn('Cannot use search index to make video channels search.', { err }) | 101 | logger.warn('Cannot use search index to make video channels search.', { err }) |
101 | 102 | ||
102 | return res.sendStatus(500) | 103 | return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500) |
103 | } | 104 | } |
104 | } | 105 | } |
105 | 106 | ||
@@ -191,7 +192,7 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons | |||
191 | } catch (err) { | 192 | } catch (err) { |
192 | logger.warn('Cannot use search index to make video search.', { err }) | 193 | logger.warn('Cannot use search index to make video search.', { err }) |
193 | 194 | ||
194 | return res.sendStatus(500) | 195 | return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500) |
195 | } | 196 | } |
196 | } | 197 | } |
197 | 198 | ||