errors: add NotImplementedError

Co-authored-by: Harry Hogg <hhogg@spotify.com>
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-02-14 17:07:57 +01:00
parent 417ae9bb08
commit 3bf83a2aab
4 changed files with 17 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/backend-app-api': patch
'@backstage/errors': patch
---
Add NotImplementedError
@@ -38,6 +38,7 @@ import {
NotModifiedError,
serializeError,
} from '@backstage/errors';
import { NotImplementedError } from '@backstage/errors';
/**
* Options used to create a {@link MiddlewareFactory}.
@@ -257,6 +258,8 @@ function getStatusCode(error: Error): number {
return 404;
case ConflictError.name:
return 409;
case NotImplementedError.name:
return 501;
default:
break;
}
+7
View File
@@ -74,6 +74,13 @@ export class ConflictError extends CustomErrorBase {}
*/
export class NotModifiedError extends CustomErrorBase {}
/**
* The server does not support the functionality required to fulfill the request.
*
* @public
*/
export class NotImplementedError extends CustomErrorBase {}
/**
* An error that forwards an underlying cause with additional context in the message.
*
+1
View File
@@ -24,6 +24,7 @@ export {
NotAllowedError,
NotFoundError,
NotModifiedError,
NotImplementedError,
} from './common';
export { CustomErrorBase } from './CustomErrorBase';
export { ResponseError } from './ResponseError';