UNPKG

auth0

Version:

Auth0 Node.js SDK for the Management API v2.

30 lines (29 loc) 1.08 kB
// This file was auto-generated by Fern from our API Definition. import * as errors from "./index.mjs"; export function handleNonStatusCodeError(error, rawResponse, method, path) { switch (error.reason) { case "non-json": throw new errors.ManagementError({ statusCode: error.statusCode, body: error.rawBody, rawResponse: rawResponse, }); case "body-is-null": throw new errors.ManagementError({ statusCode: error.statusCode, rawResponse: rawResponse, }); case "timeout": throw new errors.ManagementTimeoutError(`Timeout exceeded when calling ${method} ${path}.`); case "unknown": throw new errors.ManagementError({ message: error.errorMessage, rawResponse: rawResponse, }); default: throw new errors.ManagementError({ message: "Unknown error", rawResponse: rawResponse, }); } }