mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-24 17:34:13 +00:00
Update service exception handling
I didn't find the bug...
This commit is contained in:
parent
021def4f88
commit
3d4add3581
2 changed files with 3 additions and 2 deletions
|
@ -55,7 +55,8 @@ class BirthdayRoleUpdate : BackgroundService {
|
||||||
exceptions.Add(ex);
|
exceptions.Add(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exceptions.Count != 0) throw new AggregateException(exceptions);
|
if (exceptions.Count > 1) throw new AggregateException("Unhandled exceptions occurred when processing birthdays.", exceptions);
|
||||||
|
else if (exceptions.Count == 1) throw new Exception("An unhandled exception occurred when processing a birthday.", exceptions[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ShardBackgroundWorker : IDisposable {
|
||||||
_tickCount++;
|
_tickCount++;
|
||||||
await service.OnTick(_tickCount, _workerCanceller.Token).ConfigureAwait(false);
|
await service.OnTick(_tickCount, _workerCanceller.Token).ConfigureAwait(false);
|
||||||
} catch (Exception ex) when (ex is not TaskCanceledException) {
|
} catch (Exception ex) when (ex is not TaskCanceledException) {
|
||||||
Instance.Log(nameof(WorkerLoop), $"{CurrentExecutingService} encountered an exception:\n" + ex.ToString());
|
Instance.Log(CurrentExecutingService, ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CurrentExecutingService = null;
|
CurrentExecutingService = null;
|
||||||
|
|
Loading…
Reference in a new issue