import { brand, isBranded } from "./utils.js";
/**
 * Thrown when a non-200 response is returned from the server.
 */
export class ServerError extends Error {
    /** Determine if an error is a `ServerError` instance */
    static is(error) {
        return 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;
        brand(this);
        Object.setPrototypeOf(this, ServerError.prototype);
    }
}
//# sourceMappingURL=ServerError.js.map
