mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Log EppExceptions in EppController at INFO (vs FlowRunner at WARNING)
The logging for exceptions in FlowRunner - always at WARNING - has long been sub-optimal. For EppExceptions it's too aggressive/spammy to log at WARNING because it's generally not actionable - EppException gets properly thrown for all kinds of ordinary reasons (trying to create a resource when one already exists with that foreign key) and/or for client misbehavior that we can't control (sending bad parameter values, etc.). For non-EppException RuntimeExceptions, it's redundant with existing logging in EppController. This CL resolves this by removing that logging in FlowRunner entirely in favor of the EppController logging, where we're now logging EppExceptions at INFO in parallel with the existing logging of RuntimeExceptions at SEVERE. This has the benefit that we're now logging EppExceptions that come from FlowPicker (by way of EppExceptionInProviderException), which previously were unlogged. Note however that this does mean that in places where we run FlowRunner without EppController - exclusively test code as it stands today - we'd no longer be logging EppExceptions. If that seems like a loss, we could either reinstate logging there (at INFO) and just deal with redundant messages for most EppExceptions, or we could add it manually to places where we call FlowRunner.run() in tests and avoid the redundancy that way. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154733365
This commit is contained in:
parent
11e7374c0f
commit
f640d765e8
6 changed files with 196 additions and 76 deletions
|
@ -118,12 +118,14 @@ public final class EppController {
|
|||
try {
|
||||
return flowComponent.flowRunner().run(eppMetricBuilder);
|
||||
} catch (EppException | EppExceptionInProviderException e) {
|
||||
// The command failed. Send the client an error message.
|
||||
// The command failed. Send the client an error message, but only log at INFO since many of
|
||||
// these failures are innocuous or due to client error, so there's nothing we have to change.
|
||||
logger.info(e, "Flow returned failure response");
|
||||
EppException eppEx = (EppException) (e instanceof EppException ? e : e.getCause());
|
||||
return getErrorResponse(eppEx.getResult(), flowComponent.trid());
|
||||
} catch (Throwable e) {
|
||||
// Something bad and unexpected happened. Send the client a generic error, and log it.
|
||||
logger.severe(e, "Unexpected failure");
|
||||
// Something bad and unexpected happened. Send the client a generic error, and log at SEVERE.
|
||||
logger.severe(e, "Unexpected failure in flow execution");
|
||||
return getErrorResponse(Result.create(Code.COMMAND_FAILED), flowComponent.trid());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue