import BackError from './BackError'; export default class BackErrorBag { private readonly sizeLimit?; private backErrors; /** * @description * Creates a BackErrorBag. * With this bag, you can collect BackErrors and throw them all together. * The client will receive all errors in one package. * @param sizeLimit * Defines a size limit for the error bag. * When the size limit is reached, the bag will throw * itself and don't accept more errors. */ constructor(sizeLimit?: number); /** * @description * Creates a BackErrorBag. * With this bag, you can collect BackErrors and throw them all together. * The client will receive all errors in one package. * @example * new BackErrorBag(myError,myError2).throw(); * @param backErrors */ constructor(backErrors: BackError[]); /** * @description * Returns all BackErrors of the bag. */ getBackErrors(): BackError[]; /** * @description * Adds all BackErrors of a BackErrorBags to this bag. * @param backErrorBags */ addFromBackErrorBag(...backErrorBags: BackErrorBag[]): void; /** * @description * Adds BackErrors to this bag. * @param backErrors */ add(...backErrors: BackError[]): void; /** * @description * Empty the bag by removing all BackErrors. */ empty(): void; /** * @description * Throw this bag if it has at least one BackError. */ throwIfHasError(): void; /** * @description * Throw this bag no matter if it's empty or not */ throw(): void; /** * @description * Returns the count of BackErrors. */ get count(): number; /** * @description * Returns if this bag is not empty. * It means that the bag has at least one BackError. */ isNotEmpty(): boolean; /** * @description * Returns if the BackErrorBag is empty. */ isEmpty(): boolean; /** * @description * Returns the complete information as a string. */ toString(): string; }