UNPKG

rest-api-handler

Version:
26 lines (25 loc) 846 B
import { ApiResponseType } from './DefaultResponseProcessor'; export interface ApiExceptionConstructor<ResponseType> { new (response: ApiResponseType<ResponseType>, request: Request): ApiExceptionInterface<ResponseType>; } export interface ApiExceptionInterface<ResponseType> { getRequest: () => Request; getResponse: () => ApiResponseType<ResponseType>; } /** * Default API Exception */ export default class DefaultApiException<ResponseType> extends Error implements ApiExceptionInterface<ResponseType> { /** * Response from server that throwed an error. */ private response; /** * Constructor. * * @param response - Processed response from server. */ constructor(response: ApiResponseType<ResponseType>); getResponse(): ApiResponseType<ResponseType>; getRequest(): Request; }