UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

30 lines 1.19 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { VercelError } from "./vercelerror.js"; /** The fallback error class if no more specific error class is matched */ export class SDKError extends VercelError { constructor(message, httpMeta) { if (message) { message += `: `; } message += `Status ${httpMeta.response.status}`; const contentType = httpMeta.response.headers.get("content-type") || `""`; if (contentType !== "application/json") { message += ` Content-Type ${contentType.includes(" ") ? `"${contentType}"` : contentType}`; } const body = httpMeta.body || `""`; message += body.length > 100 ? "\n" : ". "; let bodyDisplay = body; if (body.length > 10000) { const truncated = body.substring(0, 10000); const remaining = body.length - 10000; bodyDisplay = `${truncated}...and ${remaining} more chars`; } message += `Body: ${bodyDisplay}`; message = message.trim(); super(message, httpMeta); this.name = "SDKError"; } } //# sourceMappingURL=sdkerror.js.map