fix unwrapping of nested exceptions

and enable stacktrace in responses if logging is set to trace