fix: Reduce double reporting of errors
This commit is contained in:
@ -28,7 +28,6 @@ class UserDelete extends React.Component<Props> {
|
||||
this.props.auth.logout();
|
||||
} catch (error) {
|
||||
this.props.ui.showToast(error.message);
|
||||
throw error;
|
||||
} finally {
|
||||
this.isDeleting = false;
|
||||
}
|
||||
|
@ -5,10 +5,12 @@ import stores from "stores";
|
||||
import download from "./download";
|
||||
import {
|
||||
AuthorizationError,
|
||||
BadRequestError,
|
||||
NetworkError,
|
||||
NotFoundError,
|
||||
OfflineError,
|
||||
RequestError,
|
||||
ServiceUnavailableError,
|
||||
UpdateRequiredError,
|
||||
} from "./errors";
|
||||
|
||||
@ -141,6 +143,10 @@ class ApiClient {
|
||||
throw new UpdateRequiredError(error.message);
|
||||
}
|
||||
|
||||
if (response.status === 400) {
|
||||
throw new BadRequestError(error.message);
|
||||
}
|
||||
|
||||
if (response.status === 403) {
|
||||
throw new AuthorizationError(error.message);
|
||||
}
|
||||
@ -149,6 +155,10 @@ class ApiClient {
|
||||
throw new NotFoundError(error.message);
|
||||
}
|
||||
|
||||
if (response.status === 503) {
|
||||
throw new ServiceUnavailableError(error.message);
|
||||
}
|
||||
|
||||
throw new RequestError(error.message);
|
||||
};
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
import ExtendableError from "es6-error";
|
||||
|
||||
export class AuthorizationError extends ExtendableError {}
|
||||
export class BadRequestError extends ExtendableError {}
|
||||
export class NetworkError extends ExtendableError {}
|
||||
export class NotFoundError extends ExtendableError {}
|
||||
export class OfflineError extends ExtendableError {}
|
||||
export class ServiceUnavailableError extends ExtendableError {}
|
||||
export class RequestError extends ExtendableError {}
|
||||
export class UpdateRequiredError extends ExtendableError {}
|
||||
|
@ -54,9 +54,11 @@
|
||||
ignoreErrors: [
|
||||
"ResizeObserver loop limit exceeded",
|
||||
"AuthorizationError",
|
||||
"BadRequestError",
|
||||
"NetworkError",
|
||||
"NotFoundError",
|
||||
"OfflineError",
|
||||
"ServiceUnavailableError",
|
||||
"UpdateRequiredError",
|
||||
"ChunkLoadError",
|
||||
],
|
||||
|
Reference in New Issue
Block a user