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
+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();
}