Should ApplicationError have a severity and/or custom time window? #147
Replies: 1 comment
-
|
For the severity, we might consider using values such as: enum ErrorSeverity { NORMAL, HIGH, HIGHEST }instead of In addition to a severity, it would sometimes be useful to be able to set a specific time window for how long an error is reported by the Adding the ability to set a custom time window for an application error might have a negative impact on the APIs of
// Using ApplicationErrors with the default time frame (works same as it always has)
ApplicationErrors.logAndSaveApplicationError(errorDao, LOG, exception,
"Could not update Foo with id {}", foo.id());
// Using ApplicationErrors to set a custom time frame
ApplicationErrors.usingTimeWindow(Duration.ofHours(1))
.logAndSaveApplicationError(errorDao, LOG, exception,
"Could not update Foo with id {}", foo.id());
// Using ApplicationErrorThrower with the default time frame (works same as it always has)
errorThrower.logAndSaveApplicationError(exception,
"Could not update Foo with id {}", foo.id());
// Using ApplicationErrorThrower to set a custom time frame
errorThrower.usingTimeWindow(Duration.ofHours(1))
.logAndSaveApplicationError(exception,
"Could not update Foo with id {}", foo.id());This makes the internal code more complicated, but existing code does not need to change unless it wants to use a custom time window. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This would allow us to have different levels of "error", e.g. WARN vs ERROR and we could also log at the corresponding level, whereas currently we only log at ERROR level.
Maybe it could also be tied into the health check and we set an appropriate level there as well, based on the highest priority unresolved error in the time window.
Beta Was this translation helpful? Give feedback.
All reactions