wrap method

ApplicationException wrap(
  1. dynamic cause
)

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.

  • cause an original error object Returns an original or newly created ApplicationException

Implementation

ApplicationException wrap(cause) {
  cause = ApplicationException.unwrapError(cause);

  if (cause is ApplicationException) return cause;

  withCause(cause);
  return this;
}