instrumentError method

void instrumentError(
  1. IContext? context,
  2. String name,
  3. dynamic err,
  4. [bool? reerror = false]
)

Adds instrumentation to error handling.

  • context (optional) a context to trace execution through call chain.
  • name a method name.
  • err an occured error
  • result (optional) an execution result
  • reerror flag for rethrow exception

Implementation

void instrumentError(IContext? context, String name, err,
    [bool? reerror = false]) {
  if (err != null) {
    logger.error(context, ApplicationException().wrap(err),
        'Failed to call %s method', [name]);
    counters.incrementOne('$name.call_errors');
    if (reerror != null && reerror == true) {
      throw err;
    }
  }
}