Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Runner

Orchestrates the execution of a try/catch/finally sequence.

const runner = new Runner()

runner.Try(() => {
   // Do something...
})
.Catch(Exception, e => {
   // Handle any expected errors.
})
.Finally(() => {
   // Optionally do something regardless of what happens.
})
.Done()

Hierarchy

  • Runner

Index

Properties

Methods

Properties

Protected catches

catches: CatchMap

A mapping of error types to [[CatchBlocks]] intended to handle them.

Methods

Catch

  • Adds a catch block for a specific error type.

    Parameters

    • t: ThrowableType

      the type of error handled by the catch block

    • callback: CatchBlock

      the function to be executed as the catch block

    Returns this

Done

  • Done(): void
  • Executes a fully initialized Runner. Any errors thrown that don't have a matching CatchBlock will automatically be re-thrown.

    Returns void

Finally

  • Sets the finally block.

    Parameters

    • callback: FinallyBlock

      the function to be executed as the finally block

    Returns this

Try

  • Sets the try block.

    Parameters

    • callback: TryBlock

      the function to be executed as the try block

    Returns this

Protected finally

  • finally(): undefined
  • The function to be executed as the finally block.

    Returns undefined

Protected try

  • try(): undefined
  • The function to be executed as the try block.

    Returns undefined

Generated using TypeDoc