react-logo/frontend/src/errors/api.error.js

22 lines
428 B
JavaScript

export class APIError extends Error {
constructor(endpoint, code, message, data) {
super(`APIError: ${message}`);
this.endpoint = endpoint;
this.code = code;
this.data = data;
Error.captureStackTrace(this, APIError);
}
getEndpoint() {
return this.endpoint;
}
getCode() {
return this.code;
}
getData() {
return this.data;
}
}