From 4f2ca30dabfa7259aefda61b174916448d02a9d4 Mon Sep 17 00:00:00 2001 From: Rainer Killinger Date: Tue, 6 Jul 2021 09:36:16 +0200 Subject: [PATCH] refactor: make resonse error types validatable --- src/protocol/errors/internal-server-error.ts | 2 ++ src/protocol/errors/method-not-allowed.ts | 2 ++ src/protocol/errors/not-found.ts | 2 ++ src/protocol/errors/parameters-not-acceptable.ts | 2 ++ src/protocol/errors/plugin-already-registered.ts | 2 ++ src/protocol/errors/plugin-registering-failed.ts | 2 ++ src/protocol/errors/request-body-too-large.ts | 2 ++ src/protocol/errors/syntax-error.ts | 2 ++ src/protocol/errors/too-many-requests.ts | 2 ++ src/protocol/errors/unsupported-media-type.ts | 2 ++ src/protocol/errors/validation.ts | 2 ++ 11 files changed, 22 insertions(+) diff --git a/src/protocol/errors/internal-server-error.ts b/src/protocol/errors/internal-server-error.ts index ed8bbedc..a7ae3a07 100644 --- a/src/protocol/errors/internal-server-error.ts +++ b/src/protocol/errors/internal-server-error.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned, when an internal server error occurred + * + * @validatable */ export class SCInternalServerErrorResponse extends SCError { /** diff --git a/src/protocol/errors/method-not-allowed.ts b/src/protocol/errors/method-not-allowed.ts index 35397178..8830df32 100644 --- a/src/protocol/errors/method-not-allowed.ts +++ b/src/protocol/errors/method-not-allowed.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned, when the used HTTP method is not allowed on the requested route + * + * @validatable */ export class SCMethodNotAllowedErrorResponse extends SCError { /** diff --git a/src/protocol/errors/not-found.ts b/src/protocol/errors/not-found.ts index 154f0df2..bc51dab6 100644 --- a/src/protocol/errors/not-found.ts +++ b/src/protocol/errors/not-found.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned when the requested route or resource was not found + * + * @validatable */ export class SCNotFoundErrorResponse extends SCError { /** diff --git a/src/protocol/errors/parameters-not-acceptable.ts b/src/protocol/errors/parameters-not-acceptable.ts index 14a7be82..00f4019a 100644 --- a/src/protocol/errors/parameters-not-acceptable.ts +++ b/src/protocol/errors/parameters-not-acceptable.ts @@ -18,6 +18,8 @@ import {SCError} from '../error'; /** * An error that is returned when the request is in the right format, but contains parameters that are invalid or not * acceptable. + * + * @validatable */ export class SCParametersNotAcceptable extends SCError { /** diff --git a/src/protocol/errors/plugin-already-registered.ts b/src/protocol/errors/plugin-already-registered.ts index ac33f741..90122a40 100644 --- a/src/protocol/errors/plugin-already-registered.ts +++ b/src/protocol/errors/plugin-already-registered.ts @@ -20,6 +20,8 @@ import {SCPluginMetaData} from '../routes/plugin-register'; * An error that is returned when a plugin with the same name is already registered, to prevent two copies of a plugin * running at the same time. * This usually indicates that there is more than one instance a plugin running. + * + * @validatable */ export class SCPluginAlreadyRegisteredErrorResponse extends SCError { /** diff --git a/src/protocol/errors/plugin-registering-failed.ts b/src/protocol/errors/plugin-registering-failed.ts index 010bf27d..5b490e72 100644 --- a/src/protocol/errors/plugin-registering-failed.ts +++ b/src/protocol/errors/plugin-registering-failed.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned whenever there is an unexpected error while creating a plugin + * + * @validatable */ export class SCPluginRegisteringFailedErrorResponse extends SCError { /** diff --git a/src/protocol/errors/request-body-too-large.ts b/src/protocol/errors/request-body-too-large.ts index a7717efe..003cc24a 100644 --- a/src/protocol/errors/request-body-too-large.ts +++ b/src/protocol/errors/request-body-too-large.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned, when the request body is too large. + * + * @validatable */ export class SCRequestBodyTooLargeErrorResponse extends SCError { /** diff --git a/src/protocol/errors/syntax-error.ts b/src/protocol/errors/syntax-error.ts index c03c51ff..41835cad 100644 --- a/src/protocol/errors/syntax-error.ts +++ b/src/protocol/errors/syntax-error.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned whenever there is a syntax error + * + * @validatable */ export class SCSyntaxErrorResponse extends SCError { /** diff --git a/src/protocol/errors/too-many-requests.ts b/src/protocol/errors/too-many-requests.ts index c1554e7b..823d7bc6 100644 --- a/src/protocol/errors/too-many-requests.ts +++ b/src/protocol/errors/too-many-requests.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned, when to many request are submitted at once + * + * @validatable */ export class SCTooManyRequestsErrorResponse extends SCError { /** diff --git a/src/protocol/errors/unsupported-media-type.ts b/src/protocol/errors/unsupported-media-type.ts index 24b5886c..58023262 100644 --- a/src/protocol/errors/unsupported-media-type.ts +++ b/src/protocol/errors/unsupported-media-type.ts @@ -17,6 +17,8 @@ import {SCError} from '../error'; /** * An error that is returned when the content type of the request is not supported + * + * @validatable */ export class SCUnsupportedMediaTypeErrorResponse extends SCError { /** diff --git a/src/protocol/errors/validation.ts b/src/protocol/errors/validation.ts index 94f626ca..7bcea9ff 100644 --- a/src/protocol/errors/validation.ts +++ b/src/protocol/errors/validation.ts @@ -18,6 +18,8 @@ import {SCError} from '../error'; /** * An error that is returned when the validation of a request fails + * + * @validatable */ export class SCValidationErrorResponse extends SCError { /**