"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.APIError = void 0;
const cloudinaryanalysiserror_js_1 = require("./cloudinaryanalysiserror.js");
/** The fallback error class if no more specific error class is matched */
class APIError extends cloudinaryanalysiserror_js_1.CloudinaryAnalysisError {
    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" : " ";
        message += `Body ${body}`;
        message = message.trim();
        super(message, httpMeta);
        this.name = "APIError";
    }
}
exports.APIError = APIError;
//# sourceMappingURL=apierror.js.map