callAwaitableFunctionAndHandleExceptions<T> function
Test tools helper to not leak exceptions. Used for calls to awaitable functions with non-stream input parameters. Used by the generated code.
Implementation
Future<T> callAwaitableFunctionAndHandleExceptions<T>(
Future<T> Function() call,
) async {
try {
return await call();
} catch (e) {
var handledException = _getException(e);
if (handledException != null) {
throw handledException;
}
// Rethrow user exceptions to preserve stack trace
rethrow;
}
}