rest-api-handler
Version:
Handler for REST APIs
32 lines (25 loc) • 532 B
JavaScript
/* eslint-disable no-proto */
/**
* Default API Exception
*/
class DefaultApiException extends Error {
/**
* Response from server that throwed an error.
*/
/**
* Constructor.
*
* @param response - Processed response from server.
*/
constructor(response) {
super(`Api exception: ${JSON.stringify(response.data)}`);
this.response = response;
}
getResponse() {
return this.response;
}
getRequest() {
return this.response.request;
}
}
export { DefaultApiException as default };