improve some error logs

...in particular, pass the error as a tracing param rather than directly
in the main error message. The new behavior is nicer with e.g.
OpenTelemetry.
This commit is contained in:
Scott Lamb
2023-08-03 15:42:41 -05:00
parent 9d07d24bc7
commit b9db9c11cc
12 changed files with 36 additions and 32 deletions

View File

@@ -638,13 +638,13 @@ impl Service {
}),
})
}
Err(e) if e.kind() == base::ErrorKind::Unauthenticated => {
Err(err) if err.kind() == base::ErrorKind::Unauthenticated => {
// Log the specific reason this session is unauthenticated.
// Don't let the API client see it, as it may have a
// revocation reason that isn't for their eyes.
warn!("Session authentication failed: {e}");
warn!(err = %err.chain(), "session authentication failed");
}
Err(e) => return Err(e),
Err(err) => return Err(err),
};
}