UNPKG

phonic

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%2FPhonic-Co%2Fphonic-node) [![npm shield](htt

30 lines (29 loc) 1.06 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.PhonicError({ statusCode: error.statusCode, body: error.rawBody, rawResponse: rawResponse, }); case "body-is-null": throw new errors.PhonicError({ statusCode: error.statusCode, rawResponse: rawResponse, }); case "timeout": throw new errors.PhonicTimeoutError(`Timeout exceeded when calling ${method} ${path}.`); case "unknown": throw new errors.PhonicError({ message: error.errorMessage, rawResponse: rawResponse, }); default: throw new errors.PhonicError({ message: "Unknown error", rawResponse: rawResponse, }); } }