Use a direct custom Error since backstage/errors seems unusable.

Signed-off-by: Jussi Hallila <jussi@hallila.com>
This commit is contained in:
Jussi Hallila
2021-10-21 14:37:55 +02:00
parent b427f4ba0b
commit a1afbe0498
3 changed files with 5 additions and 24 deletions
+2 -11
View File
@@ -4,7 +4,6 @@
```ts
import { Config } from '@backstage/config';
import { CustomErrorBase } from '@backstage/errors';
import { DateTime } from 'luxon';
import { Logger as Logger_2 } from 'winston';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
@@ -32,16 +31,8 @@ export type CheckResult = {
};
// @public
export class CheckValidationError extends CustomErrorBase {
constructor({
message,
cause,
errors,
}: {
message: string;
cause?: Error;
errors?: any;
});
export class CheckValidationError extends Error {
constructor({ message, errors }: { message: string; errors?: any });
// (undocumented)
errors?: any;
}
@@ -31,7 +31,6 @@
},
"dependencies": {
"@backstage/backend-common": "^0.9.0",
"@backstage/errors": "^0.1.2",
"@backstage/config": "^0.1.8",
"@types/luxon": "^2.0.5",
"luxon": "^2.0.2",
+3 -12
View File
@@ -15,7 +15,6 @@
*/
import { TechInsightsStore } from './persistence';
import { CheckResponse, FactResponse } from './responses';
import { CustomErrorBase } from '@backstage/errors';
/**
* A factory wrapper to construct FactChecker implementations.
@@ -192,19 +191,11 @@ export type CheckValidationResponse = {
*
* @public
*/
export class CheckValidationError extends CustomErrorBase {
export class CheckValidationError extends Error {
errors?: any;
constructor({
message,
cause,
errors,
}: {
message: string;
cause?: Error;
errors?: any;
}) {
super(message, cause);
constructor({ message, errors }: { message: string; errors?: any }) {
super(message);
this.errors = errors;
}
}