"use strict";
/**
 * Error classes for FFI-level errors.
 *
 * These wrap the protobuf error types and provide proper Error inheritance
 * for use with instanceof checks and stack traces.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectorError = exports.IntegrationError = void 0;
/**
 * Exception raised when req_transformer fails (integration error).
 * Wraps IntegrationError proto and provides access to proto fields.
 */
class IntegrationError extends Error {
    proto;
    constructor(proto) {
        super(proto.errorMessage || proto.error_message);
        this.proto = proto;
    }
    get errorCode() { return this.proto.errorCode || this.proto.error_code; }
    get suggestedAction() { return this.proto.suggestedAction || this.proto.suggested_action; }
    get docUrl() { return this.proto.docUrl || this.proto.doc_url; }
}
exports.IntegrationError = IntegrationError;
/**
 * Exception raised when res_transformer fails (response transformation error).
 * Wraps ConnectorError proto and provides access to proto fields.
 */
class ConnectorError extends Error {
    proto;
    constructor(proto) {
        super(proto.errorMessage || proto.error_message);
        this.proto = proto;
    }
    get errorCode() { return this.proto.errorCode || this.proto.error_code; }
    get httpStatusCode() { return this.proto.httpStatusCode || this.proto.http_status_code; }
}
exports.ConnectorError = ConnectorError;
//# sourceMappingURL=errors.js.map