exception method

Future<void> exception(
  1. dynamic exception, {
  2. String? caller,
})

Implementation

Future<void> exception(dynamic exception, {String? caller}) async {
  try {
    // show dialog in debug mode only
    // if (kDebugMode) DialogService().show(type: DialogType.error, title: phrase.error, description: 'Exception: $exception Routine: $caller');

    // print in debug mode only
    if (kDebugMode) {
      print('Exception: $exception${caller != null ? ' -> $caller' : ''}');
    }

    // add the entry
    hive_log.Log e = hive_log.Log(
        type: "exception", message: '$exception', caller: caller);
    _addEntry(e);
  } catch (ex) {
    Log().exception(
        'Catch - Exception: $exception${caller != null ? ' -> $caller' : ''}');
  }
}