From f2eb23cd87cf32b8fe545178143b5f49e06a58da Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 8 Dec 2020 21:16:10 +0100 Subject: 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 --- server/tools/peertube-redundancy.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/tools') 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' import { getAdminTokenOrDie, getServerCredentials } from './cli' import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' import { addVideoRedundancy, listVideoRedundancies, removeVideoRedundancy } from '@shared/extra-utils/server/redundancy' +import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' import validator from 'validator' import * as CliTable3 from 'cli-table3' import { URL } from 'url' @@ -124,9 +125,9 @@ async function addRedundancyCLI (options: { videoId: number }) { process.exit(0) } catch (err) { - if (err.message.includes(409)) { + if (err.message.includes(HttpStatusCode.CONFLICT_409)) { console.error('This video is already duplicated by your instance.') - } else if (err.message.includes(404)) { + } else if (err.message.includes(HttpStatusCode.NOT_FOUND_404)) { console.error('This video id does not exist.') } else { console.error(err) -- cgit v1.2.3