"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CombinedProtocolErrors = void 0;
const utils_js_1 = require("./utils.cjs");
function defaultFormatMessage(errors) {
    return errors.map((e) => e.message || "Error message not found.").join("\n");
}
/**
 * Fatal transport-level errors returned when executing a subscription using the
 * multipart HTTP subscription protocol. See the documentation on the
 * [multipart HTTP protocol for GraphQL Subscriptions](https://www.apollographql.com/docs/graphos/routing/operations/subscriptions/multipart-protocol) for more information on these errors.
 */
class CombinedProtocolErrors extends Error {
    /** Determine if an error is a `CombinedProtocolErrors` instance */
    static is(error) {
        return (0, utils_js_1.isBranded)(error, "CombinedProtocolErrors");
    }
    static formatMessage = defaultFormatMessage;
    errors;
    constructor(protocolErrors) {
        super(CombinedProtocolErrors.formatMessage(protocolErrors, {
            defaultFormatMessage,
        }));
        this.name = "CombinedProtocolErrors";
        this.errors = protocolErrors;
        (0, utils_js_1.brand)(this);
        Object.setPrototypeOf(this, CombinedProtocolErrors.prototype);
    }
}
exports.CombinedProtocolErrors = CombinedProtocolErrors;
//# sourceMappingURL=CombinedProtocolErrors.cjs.map
