throw()

Throws an error of the given identification

CommonErrors.prototype.throw()

Throws an error of the given id if the unique id was provided in the constructor.

common-errors.class.ts
public throw<ErrorId extends Id>(id: ErrorId): void {
  if (this.isAllowedId(id)) {
    throw this.errors.get(id);
  }
}

Generic type variables

ErrorIdextendsId

A generic type variable ErrorId constrained by the generic type variable Id of the CommonErrors object indicates the type picked from the Id and its exact type is useful in picking the specific error from the storage.

Parameters

The unique identification of a generic type variable ErrorId to remove the error from the object.

Return type

this

Example usage

Last updated

Was this helpful?