owm-onecall-api
Version:
A wrapper for OpenWeatherMap's 'onecall' API.
36 lines (35 loc) • 945 B
TypeScript
/**
* Base class for creating an HTTP related exception.
*
* ```typescript
* throw new HttpException(500, 'Server Error')
* ```
*
* @internal
*/
export declare class HttpException extends Error {
readonly code: number;
readonly data?: any;
/**
* Create a new instance.
*
* @param code Http error code, ie 200, 400-500.
* @param reason Error message.
* @param data Extra data to add to the error.
*/
constructor(code: number, reason: string, data?: any);
}
/**
* Helper function for creating a 400 - Bad Request `HttpException`
*
* @internal
* @param data Extra data to add to the error.
*/
export declare function badRequest(data?: any): HttpException;
/**
* Helper function for creating a 404 - Not Found `HttpException`
*
* @internal
* @param data Extra data to add to the error.
*/
export declare function notFound(data?: any): HttpException;