safeInvoke method
Implementation
Future safeInvoke(Request req, String name, Function() operation,
Function(Exception err) error) async {
var correlationId = getCorrelationId(req);
var timing = instrument(correlationId, name);
try {
return await operation();
} catch (err) {
instrumentError(correlationId, name, err);
return await error(ApplicationException().wrap(err));
} finally {
timing.endTiming();
}
}