Options
All
  • Public
  • Public/Protected
  • All
Menu

Class InvocationException

Errors returned by remote services or by the network during call attempts.

Hierarchy

Index

Constructors

constructor

  • new InvocationException(correlation_id?: string, code?: string, message?: string): InvocationException
  • Creates an error instance and assigns its values.

    see

    ErrorCategory

    Parameters

    • Default value correlation_id: string = null

      (optional) a unique transaction id to trace execution through call chain.

    • Default value code: string = null

      (optional) a unique error code. Default: "UNKNOWN"

    • Default value message: string = null

      (optional) a human-readable description of the error.

    Returns InvocationException

Properties

category

category: string

Standard error category

cause

cause: string

Original error wrapped by this exception

code

code: string = "UNKNOWN"

A unique error code

correlation_id

correlation_id: string

A unique transaction id to trace execution throug call chain

details

A map with additional details that can be used to restore error description in other languages

message

message: string

A human-readable error description (usually written in English)

stack_trace

stack_trace: string

Stack trace of the exception

status

status: number = 500

HTTP status code associated with this error type

Static message

message: string

Static name

name: string

Static Optional stack

stack: string

Methods

getCauseString

  • getCauseString(): string
  • Gets original error wrapped by this exception as a string message.

    Returns string

    an original error message.

getStackTraceString

  • getStackTraceString(): string

setCauseString

  • setCauseString(value: string): void
  • Sets original error wrapped by this exception as a string message.

    Parameters

    • value: string

      an original error message.

    Returns void

setStackTraceString

  • setStackTraceString(value: string): void
  • Sets a stack trace where this exception occured.

    Parameters

    • value: string

      a stack trace as a string

    Returns void

withCause

  • Sets a original error wrapped by this exception

    This method returns reference to this exception to implement Builder pattern to chain additional calls.

    Parameters

    • cause: Error

      original error object

    Returns ApplicationException

    this exception object

withCode

  • Sets a unique error code.

    This method returns reference to this exception to implement Builder pattern to chain additional calls.

    Parameters

    • code: string

      a unique error code

    Returns ApplicationException

    this exception object

withCorrelationId

  • Sets a correlation id which can be used to trace this error through a call chain.

    This method returns reference to this exception to implement Builder pattern to chain additional calls.

    Parameters

    • correlationId: string

      a unique transaction id to trace error through call chain

    Returns ApplicationException

    this exception object

withDetails

  • Sets a parameter for additional error details. This details can be used to restore error description in other languages.

    This method returns reference to this exception to implement Builder pattern to chain additional calls.

    Parameters

    • key: string

      a details parameter name

    • value: any

      a details parameter name

    Returns ApplicationException

    this exception object

withStackTrace

  • Sets a stack trace for this error.

    This method returns reference to this exception to implement Builder pattern to chain additional calls.

    Parameters

    • stackTrace: string

      a stack trace where this error occured

    Returns ApplicationException

    this exception object

withStatus

  • Sets a HTTP status code which shall be returned by REST calls.

    This method returns reference to this exception to implement Builder pattern to chain additional calls.

    Parameters

    • status: number

      an HTTP error code.

    Returns ApplicationException

    this exception object

wrap

  • Wraps another exception into an application exception object.

    If original exception is of ApplicationException type it is returned without changes. Otherwise a new ApplicationException is created and original error is set as its cause.

    Parameters

    • cause: any

      an original error object

    Returns ApplicationException

    an original or newly created ApplicationException

Static unwrapError

  • unwrapError(error: any): any
  • Unwraps original exception through wrapped exception objects.

    Many frameworks like Seneca or restify wrap original exception. That may result in propagating less specific errors and can hide causes of the errors.

    Parameters

    • error: any

      an error object

    Returns any

    an original error object

Static wrapError

  • Wraps another exception into specified application exception object.

    If original exception is of ApplicationException type it is returned without changes. Otherwise the original error is set as a cause to specified ApplicationException object.

    see

    wrap

    Parameters

    • error: ApplicationException

      an ApplicationException object to wrap the cause

    • cause: any

      an original error object

    Returns ApplicationException

    an original or newly created ApplicationException

Generated using TypeDoc