"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.InvalidCapacityErrorSym = exports.InvalidCapacityError = void 0;
exports.ensureCapacity = ensureCapacity;
exports.isInvalidCapacityError = isInvalidCapacityError;

var _a;

const InvalidCapacityErrorSym = /*#__PURE__*/Symbol.for("@effect/core/io/Hub/errors/InvalidCapacity");
exports.InvalidCapacityErrorSym = InvalidCapacityErrorSym;

class InvalidCapacityError extends Error {
  constructor(message) {
    super(message);
    this[_a] = "InvalidCapacityError";
    this.name = this[InvalidCapacityErrorSym];
  }

}

exports.InvalidCapacityError = InvalidCapacityError;
_a = InvalidCapacityErrorSym;

function ensureCapacity(capacity) {
  if (capacity <= 0) {
    throw new InvalidCapacityError(`A Hub cannot have a capacity of ${capacity}`);
  }
}

function isInvalidCapacityError(u) {
  return u instanceof Error && u[InvalidCapacityErrorSym] === "InvalidCapacityError";
}
//# sourceMappingURL=errors.js.map