unwrapError static method

dynamic unwrapError(
  1. dynamic error
)

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.

  • error an error object Returns an original error object

Implementation

/// - [error]     an error object
/// Returns         an original error object

static dynamic unwrapError(error) {
  if (error == null) return null;

  // // Unwrapping restify exceptions
  // if (error.body && !_.isEmpty(error.body))
  //     error = error.body;

  return error;
}