UNPKG

rest-api-handler

Version:
34 lines (26 loc) 542 B
'use strict'; /* 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; } } module.exports = DefaultApiException;