1.0.2 • Published 5 years ago

@yo1dog/http-response-error v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

http-response-error

HTTP Response Error

Quick Start

const HTTPResponseError = require('@yo1dog/http-response-error');

const res = await request('https://www.example.com/fubar');
if (res.statusCode !== 200) {
  throw new HTTPResponseError(res, `Unable to get fubar.`);
}

Docs

new HTTPResponseError(res, [message])

paramtypedescription
resResponseResponse object.
messagestringA human-readable description of the error.

HTTPResponseError.status

HTTPResponseError.bodyObj

HTTPResponseError.bodyStr

HTTPResponseError.res

HTTPResponseError.req