diff --git a/src/core/protocol/errors/ErrorResponse.ts b/src/core/protocol/errors/ErrorResponse.ts index 15a9868d..26473a43 100644 --- a/src/core/protocol/errors/ErrorResponse.ts +++ b/src/core/protocol/errors/ErrorResponse.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -127,6 +127,20 @@ export class SCNotFoundErrorResponse extends SCError { } } +/** + * An error that is returned whenever there is a syntax error + */ +export class SCSyntaxError extends SCError { + /** + * Create a SyntaxError + * @param message Describes the syntax error + * @param stack Set to true if a stack trace should be created + */ + constructor(message: string, stack?: boolean) { + super('SyntaxError', message, 400, stack); + } +} + /** * An error that is returned, when an internal server error occurred */ diff --git a/src/core/protocol/routes/INDEX/IndexRequest.ts b/src/core/protocol/routes/INDEX/IndexRequest.ts index 03925a84..05a502e5 100644 --- a/src/core/protocol/routes/INDEX/IndexRequest.ts +++ b/src/core/protocol/routes/INDEX/IndexRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -31,6 +31,7 @@ export class SCIndexRoute extends SCAbstractRoute { this.errorNames = [ 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/TYPE/UID/ThingUpdateRequest.ts b/src/core/protocol/routes/TYPE/UID/ThingUpdateRequest.ts index b22b34e1..9e004f16 100644 --- a/src/core/protocol/routes/TYPE/UID/ThingUpdateRequest.ts +++ b/src/core/protocol/routes/TYPE/UID/ThingUpdateRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -32,6 +32,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute { 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', 'SCNotFoundErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/bookAvailability/BookAvailabilityRequest.ts b/src/core/protocol/routes/bookAvailability/BookAvailabilityRequest.ts index e57ee09e..e456715f 100644 --- a/src/core/protocol/routes/bookAvailability/BookAvailabilityRequest.ts +++ b/src/core/protocol/routes/bookAvailability/BookAvailabilityRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -63,6 +63,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute { 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', 'SCNotFoundErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/bulk/BulkRequest.ts b/src/core/protocol/routes/bulk/BulkRequest.ts index a157f02f..48446e27 100644 --- a/src/core/protocol/routes/bulk/BulkRequest.ts +++ b/src/core/protocol/routes/bulk/BulkRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -62,6 +62,7 @@ export class SCBulkRoute extends SCAbstractRoute { this.errorNames = [ 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/bulk/UID/BulkAddRequest.ts b/src/core/protocol/routes/bulk/UID/BulkAddRequest.ts index bcde6a95..ba8e50c8 100644 --- a/src/core/protocol/routes/bulk/UID/BulkAddRequest.ts +++ b/src/core/protocol/routes/bulk/UID/BulkAddRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -31,6 +31,7 @@ export class SCBulkAddRoute extends SCAbstractRoute { 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', 'SCNotFoundErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/bulk/UID/BulkDoneRequest.ts b/src/core/protocol/routes/bulk/UID/BulkDoneRequest.ts index f305de5a..00456ece 100644 --- a/src/core/protocol/routes/bulk/UID/BulkDoneRequest.ts +++ b/src/core/protocol/routes/bulk/UID/BulkDoneRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -31,6 +31,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute { 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', 'SCNotFoundErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/feedback/FeedbackRequest.ts b/src/core/protocol/routes/feedback/FeedbackRequest.ts index 9151f5ea..f9b7196d 100644 --- a/src/core/protocol/routes/feedback/FeedbackRequest.ts +++ b/src/core/protocol/routes/feedback/FeedbackRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -71,6 +71,7 @@ export class SCFeedbackRoute extends SCAbstractRoute { this.errorNames = [ 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ]; diff --git a/src/core/protocol/routes/search/MultiSearchRequest.ts b/src/core/protocol/routes/search/MultiSearchRequest.ts index 0866d53e..91b942fd 100644 --- a/src/core/protocol/routes/search/MultiSearchRequest.ts +++ b/src/core/protocol/routes/search/MultiSearchRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -37,6 +37,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute { this.errorNames = [ 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', + 'SCSyntaxError', 'SCTooManyRequestsErrorResponse', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', diff --git a/src/core/protocol/routes/search/SearchRequest.ts b/src/core/protocol/routes/search/SearchRequest.ts index 85e47fca..01117273 100644 --- a/src/core/protocol/routes/search/SearchRequest.ts +++ b/src/core/protocol/routes/search/SearchRequest.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018-2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -63,6 +63,7 @@ export class SCSearchRoute extends SCAbstractRoute { this.errorNames = [ 'SCInternalServerErrorResponse', 'SCMethodNotAllowedErrorResponse', + 'SCSyntaxError', 'SCUnsupportedMediaTypeErrorResponse', 'SCValidationErrorResponse', ];