UNPKG

intercom-client

Version:

Official Node bindings to the Intercom API

29 lines (28 loc) 964 B
"use strict"; // This file was auto-generated by Fern from our API Definition. Object.defineProperty(exports, "__esModule", { value: true }); exports.IntercomError = void 0; const json_js_1 = require("../core/json.js"); class IntercomError extends Error { constructor({ message, statusCode, body, rawResponse, }) { super(buildMessage({ message, statusCode, body })); Object.setPrototypeOf(this, IntercomError.prototype); this.statusCode = statusCode; this.body = body; this.rawResponse = rawResponse; } } exports.IntercomError = IntercomError; function buildMessage({ message, statusCode, body, }) { const 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"); }