wrapError method
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.
error
an ApplicationException object to wrap the causecause
an original error object Returns an original or newly created ApplicationException
See wrap