Class Chain<I, O, II, OO>

A chain wraps a middleware to facilitate composition by chaining it with other middleware

Type Parameters

  • I
  • O
  • II
  • OO

Implements

Constructors

Methods

Constructors

Methods

  • Chains an error handler to the current middleware

    Parameters

    Returns Chain<I, O, II, OO>

    New chain with the chained error handler

    Remarks

    The error handler is chained by catching errors thrown by the call to the next function. It receives both the error and the input that was given to the next call. It needs to either produce the output that the next function would have, or re-throw the error it received if it can't.

    Note that if the call to next mutated the input in-place before throwing, the error handler will receive the mutated input.

  • Chains a middleware to the current one

    Type Parameters

    • III

      New input passed to the next function by the chained middleware

    • OOO

      New output expected from the next function by the chained middleware

    Parameters

    Returns Chain<I, O, III, OOO>

    New chain with the chained middleware

    Remarks

    The chained middleware will receive the input passed to the next function by the current middleware. It needs to produce the output that the current middleware expects from the next function.

Generated using TypeDoc