All files / src/api TimeoutException.ts

100% Statements 7/7
100% Branches 1/1
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3114x         14x                 5x 4x 4x                   14x 5x      
import { ConcurrencyException } from "@jonloucks/concurrency-ts/api/ConcurrencyException";
 
/**
 * Runtime exception thrown for Concurrency timeout related problems.
 */
export class TimeoutException extends ConcurrencyException {
 
  /**
   * Passthrough for {@link Error(String, Throwable)}
   *
   * @param message the message for this exception
   * @param thrown  the cause of this exception, null is allowed
   */
  public constructor(message: string, thrown: Error | null = null) {
    super(message, thrown);
    this.name = "TimeoutException";
    Object.setPrototypeOf(this, TimeoutException.prototype)
  }
}
 
/**
 * Determine if an instance is a TimeoutException
 *
 * @param instance the instance to check
 * @returns true if the instance is a TimeoutException
 */
export function guard(instance: unknown): instance is TimeoutException {
  return instance instanceof TimeoutException;
}