"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerParseError = void 0;
/**
 * Thrown when failing to parse the response as JSON from the server.
 */
class ServerParseError extends Error {
    /**
     * The server response.
     */
    response;
    /**
     * The status code returned from the server.
     */
    statusCode;
    /**
     * The raw body text returned in the server response.
     */
    bodyText;
    constructor(originalParseError, options) {
        super(originalParseError instanceof Error ?
            originalParseError.message
            : "Could not parse server response", { cause: originalParseError });
        this.name = "ServerParseError";
        this.response = options.response;
        this.statusCode = options.response.status;
        this.bodyText = options.bodyText;
        Object.setPrototypeOf(this, ServerParseError.prototype);
    }
}
exports.ServerParseError = ServerParseError;
//# sourceMappingURL=ServerParseError.cjs.map
