/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { describeList, ImplementationError, MatterAggregateError, MatterError } from "@matter/general";
class BehaviorInitializationError extends MatterError {
  constructor(message, cause) {
    super(message);
    this.cause = cause;
  }
}
class EndpointBehaviorsError extends MatterAggregateError {
  constructor(causes) {
    super(causes, `Behaviors have errors`);
  }
}
class EndpointPartsError extends MatterError {
  constructor(causes) {
    let suffix;
    const causesArray = [...causes];
    if (causesArray.length) {
      suffix = `${causesArray.length === 1 ? "" : "s"} ${describeList("and", ...causesArray.map((cause) => cause.toString()))}`;
    } else {
      suffix = "";
    }
    super(`Error initializing part${suffix}`);
  }
}
class PartNotFoundError extends MatterError {
}
class EndpointBehaviorNotPresentError extends MatterError {
  constructor(behaviorId) {
    super(`Behavior "${behaviorId}" is not present on this endpoint`);
  }
}
class EndpointBehaviorNotClusterError extends MatterError {
  constructor(behaviorId) {
    super(`Behavior "${behaviorId}" is present but is not a cluster behavior`);
  }
}
class AttributeNotPresentError extends MatterError {
  constructor(behaviorId, attributeName) {
    super(`Attribute "${attributeName}" is not present on behavior "${behaviorId}"`);
  }
}
class EndpointReadFailedError extends MatterError {
  failed;
  partial;
  constructor(detail) {
    super(`Endpoint read failed for ${detail.failed.length} path(s)`);
    this.failed = detail.failed;
    this.partial = detail.partial;
  }
}
class InvalidGroupOperationError extends ImplementationError {
}
export {
  AttributeNotPresentError,
  BehaviorInitializationError,
  EndpointBehaviorNotClusterError,
  EndpointBehaviorNotPresentError,
  EndpointBehaviorsError,
  EndpointPartsError,
  EndpointReadFailedError,
  InvalidGroupOperationError,
  PartNotFoundError
};
//# sourceMappingURL=errors.js.map
