All Downloads are FREE. Search and download functionalities are using the official Maven repository.

utils.RequestError.js Maven / Gradle / Ivy

The newest version!
class RequestError extends Error {
    constructor(message, status, headers, body = null, json = null) {
        super(message)
        this.name = 'RequestError'
        this.message = message
        this.status = status
        this.headers = headers
        this.body = body
        this.json = json
        if (Error.captureStackTrace) {
            Error.captureStackTrace(this, this.constructor)
        } else {
            this.stack = new Error(message).stack
        }
    }

    getMeta() {
        return this.json && this.json.meta
    }
}

export default RequestError




© 2015 - 2024 Weber Informatics LLC | Privacy Policy