/**
 * Custom Error Classes for Host Router
 *
 * All host router errors extend HostRouterError for easy instance checking.
 */
/**
 * Base error class for all host router errors
 */
export class HostRouterError extends Error {
    constructor(message, options) {
        super(message);
        if (options?.cause) {
            this.cause = options.cause;
        }
        this.name = 'HostRouterError';
        Object.setPrototypeOf(this, HostRouterError.prototype);
    }
}
/**
 * Error thrown when pattern validation fails
 */
export class InvalidPatternError extends HostRouterError {
    constructor(pattern, reason, options) {
        super(`Invalid pattern "${pattern}": ${reason}`, options);
        this.name = 'InvalidPatternError';
        Object.setPrototypeOf(this, InvalidPatternError.prototype);
    }
}
/**
 * Error thrown when cookie override is not allowed
 */
export class HostOverrideNotAllowedError extends HostRouterError {
    constructor(currentHost, cookieName, options) {
        super(`Host override not allowed on "${currentHost}" (cookie: ${cookieName})`, options);
        this.name = 'HostOverrideNotAllowedError';
        Object.setPrototypeOf(this, HostOverrideNotAllowedError.prototype);
    }
}
/**
 * Error thrown when cookie hostname is invalid
 */
export class InvalidHostnameError extends HostRouterError {
    constructor(hostname, options) {
        super(`Invalid hostname format: "${hostname}"`, options);
        this.name = 'InvalidHostnameError';
        Object.setPrototypeOf(this, InvalidHostnameError.prototype);
    }
}
/**
 * Error thrown when custom validation fails
 */
export class HostValidationError extends HostRouterError {
    constructor(message, cause) {
        super(message, { cause });
        this.name = 'HostValidationError';
        Object.setPrototypeOf(this, HostValidationError.prototype);
    }
}
/**
 * Error thrown when no route matches
 */
export class NoRouteMatchError extends HostRouterError {
    constructor(hostname, pathname, options) {
        super(`No route matched for ${hostname}${pathname}`, options);
        this.name = 'NoRouteMatchError';
        Object.setPrototypeOf(this, NoRouteMatchError.prototype);
    }
}
/**
 * Error thrown when handler type is invalid
 */
export class InvalidHandlerError extends HostRouterError {
    constructor(handler, options) {
        super(`Invalid handler type: ${typeof handler}`, options);
        this.name = 'InvalidHandlerError';
        Object.setPrototypeOf(this, InvalidHandlerError.prototype);
    }
}
//# sourceMappingURL=errors.js.map