UNPKG

@respeecher/respeecher-js

Version:

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Frespeecher%2Frespeecher-js) [![npm shield](

31 lines (30 loc) 980 B
"use strict"; /** * This file was auto-generated by Fern from our API Definition. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.RespeecherError = void 0; const json_js_1 = require("../core/json.js"); class RespeecherError extends Error { constructor({ message, statusCode, body, rawResponse, }) { super(buildMessage({ message, statusCode, body })); Object.setPrototypeOf(this, RespeecherError.prototype); this.statusCode = statusCode; this.body = body; this.rawResponse = rawResponse; } } exports.RespeecherError = RespeecherError; function buildMessage({ message, statusCode, body, }) { let lines = []; if (message != null) { lines.push(message); } if (statusCode != null) { lines.push(`Status code: ${statusCode.toString()}`); } if (body != null) { lines.push(`Body: ${(0, json_js_1.toJson)(body, undefined, 2)}`); } return lines.join("\n"); }