aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-08 21:16:10 +0100
committerGitHub <noreply@github.com>2020-12-08 21:16:10 +0100
commitf2eb23cd87cf32b8fe545178143b5f49e06a58da (patch)
treeaf7d59945af70e28fd85047e2c688c59a908f548 /server/tools
parentc977fd3ec931c059111ddb2b8d6ddbb20b6b99a1 (diff)
downloadPeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.gz
PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.zst
PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.zip
emit more specific status codes on video upload (#3423)
- reduce http status codes list to potentially useful codes - convert more codes to typed ones - factorize html generator for error responses
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/peertube-redundancy.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts
index 1ab58a438..fe482daf4 100644
--- a/server/tools/peertube-redundancy.ts
+++ b/server/tools/peertube-redundancy.ts
@@ -7,6 +7,7 @@ import * as program from 'commander'
7import { getAdminTokenOrDie, getServerCredentials } from './cli' 7import { getAdminTokenOrDie, getServerCredentials } from './cli'
8import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' 8import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
9import { addVideoRedundancy, listVideoRedundancies, removeVideoRedundancy } from '@shared/extra-utils/server/redundancy' 9import { addVideoRedundancy, listVideoRedundancies, removeVideoRedundancy } from '@shared/extra-utils/server/redundancy'
10import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
10import validator from 'validator' 11import validator from 'validator'
11import * as CliTable3 from 'cli-table3' 12import * as CliTable3 from 'cli-table3'
12import { URL } from 'url' 13import { URL } from 'url'
@@ -124,9 +125,9 @@ async function addRedundancyCLI (options: { videoId: number }) {
124 125
125 process.exit(0) 126 process.exit(0)
126 } catch (err) { 127 } catch (err) {
127 if (err.message.includes(409)) { 128 if (err.message.includes(HttpStatusCode.CONFLICT_409)) {
128 console.error('This video is already duplicated by your instance.') 129 console.error('This video is already duplicated by your instance.')
129 } else if (err.message.includes(404)) { 130 } else if (err.message.includes(HttpStatusCode.NOT_FOUND_404)) {
130 console.error('This video id does not exist.') 131 console.error('This video id does not exist.')
131 } else { 132 } else {
132 console.error(err) 133 console.error(err)