UNPKG

auth0

Version:

Auth0 Node.js SDK for the Management API v2.

29 lines (28 loc) 955 B
// This file was auto-generated by Fern from our API Definition. import { toJson } from "../core/json.mjs"; export class ManagementError extends Error { constructor({ message, statusCode, body, rawResponse, }) { super(buildMessage({ message, statusCode, body })); Object.setPrototypeOf(this, new.target.prototype); if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } this.name = this.constructor.name; this.statusCode = statusCode; this.body = body; this.rawResponse = rawResponse; } } 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: ${toJson(body, undefined, 2)}`); } return lines.join("\n"); }