"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerError = void 0;
const utils_js_1 = require("./utils.cjs");
/**
 * Thrown when a non-200 response is returned from the server.
 */
class ServerError extends Error {
    /** Determine if an error is a `ServerError` instance */
    static is(error) {
        return (0, utils_js_1.isBranded)(error, "ServerError");
    }
    /**
     * The server response.
     */
    response;
    /**
     * The status code returned from the server.
     */
    statusCode;
    /**
     * The raw response body text.
     */
    bodyText;
    constructor(message, options) {
        super(message);
        this.name = "ServerError";
        this.response = options.response;
        this.statusCode = options.response.status;
        this.bodyText = options.bodyText;
        (0, utils_js_1.brand)(this);
        Object.setPrototypeOf(this, ServerError.prototype);
    }
}
exports.ServerError = ServerError;
//# sourceMappingURL=ServerError.cjs.map
