Better error handling around stacktrace expansion