import { buildProviderProtocolErrorWithNative } from '../router/virtual-router/engine-selection/native-shared-conversion-semantics.js';
export class ProviderProtocolError extends Error {
    code;
    protocol;
    providerType;
    category;
    details;
    constructor(message, options) {
        super(message);
        this.name = 'ProviderProtocolError';
        const native = buildProviderProtocolErrorWithNative({
            message,
            code: options.code,
            protocol: options.protocol,
            providerType: options.providerType,
            category: options.category,
            details: options.details
        });
        this.code = options.code;
        this.protocol = typeof native.protocol === 'string' ? native.protocol : options.protocol;
        this.providerType = typeof native.providerType === 'string' ? native.providerType : options.providerType;
        this.category = native.category || options.category || 'EXTERNAL_ERROR';
        this.details = native.details ?? options.details;
    }
}
