Use @backstage/errors

Signed-off-by: Julio Zynger <julio.zynger@soundcloud.com>
This commit is contained in:
Julio Zynger
2022-03-07 12:59:53 +02:00
committed by Fredrik Adelöw
parent 9e04715967
commit aee6d9d60c
2 changed files with 3 additions and 3 deletions
+1
View File
@@ -25,6 +25,7 @@
"@backstage/catalog-model": "^0.11.0",
"@backstage/core-components": "^0.8.10",
"@backstage/core-plugin-api": "^0.7.0",
"@backstage/errors": "^0.2.2",
"@backstage/plugin-catalog-react": "^0.7.0",
"@backstage/theme": "^0.2.15",
"@material-ui/core": "^4.12.2",
+2 -3
View File
@@ -15,6 +15,7 @@
*/
import { ConfigApi, DiscoveryApi } from '@backstage/core-plugin-api';
import { ResponseError } from '@backstage/errors';
import { AggregatedError, NotFoundInInstance } from '../types';
/** @public */
@@ -111,9 +112,7 @@ export class PeriskopClient implements PeriskopApi {
body: await response.text(),
};
}
throw new Error(
`failed to fetch data, status ${response.status}: ${response.statusText}`,
);
throw await ResponseError.fromResponse(response);
}
return response.json();
}