/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: fb6b2b49c445
 */
import * as z from "zod/v4/core";
export class SDKValidationError extends Error {
    /**
     * The raw value that failed validation.
     */
    rawValue;
    /**
     * The raw message that failed validation.
     */
    rawMessage;
    // Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError`
    static [Symbol.hasInstance](instance) {
        if (!(instance instanceof Error))
            return false;
        if (!("rawValue" in instance))
            return false;
        if (!("rawMessage" in instance))
            return false;
        if (!("pretty" in instance))
            return false;
        if (typeof instance.pretty !== "function")
            return false;
        return true;
    }
    constructor(message, cause, rawValue) {
        super(`${message}: ${cause}`);
        this.name = "SDKValidationError";
        this.cause = cause;
        this.rawValue = rawValue;
        this.rawMessage = message;
    }
    /**
     * Return a pretty-formatted error message if the underlying validation error
     * is a ZodError or some other recognized error type, otherwise return the
     * default error message.
     */
    pretty() {
        if (this.cause instanceof z.$ZodError) {
            return `${this.rawMessage}\n${formatZodError(this.cause)}`;
        }
        else {
            return this.toString();
        }
    }
}
export function formatZodError(err) {
    return z.prettifyError(err);
}
//# sourceMappingURL=sdkvalidationerror.js.map