import { brand, isBranded } from "./utils.js";
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.
 */
export class CombinedProtocolErrors extends Error {
    /** Determine if an error is a `CombinedProtocolErrors` instance */
    static is(error) {
        return isBranded(error, "CombinedProtocolErrors");
    }
    static formatMessage = defaultFormatMessage;
    errors;
    constructor(protocolErrors) {
        super(CombinedProtocolErrors.formatMessage(protocolErrors, {
            defaultFormatMessage,
        }));
        this.name = "CombinedProtocolErrors";
        this.errors = protocolErrors;
        brand(this);
        Object.setPrototypeOf(this, CombinedProtocolErrors.prototype);
    }
}
//# sourceMappingURL=CombinedProtocolErrors.js.map
