Converts the exception to a WrappedException.
Wraps the exception in a WrappedException.
Converts the exception to a wrapped exception if wrap is true.