Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerError's description of the underlying error (underlyingErrorDescription) can elides the error description unless it is a LocalizedError #631

Open
francescomikulis opened this issue Sep 18, 2024 · 3 comments
Labels
kind/feature New feature. status/triage Collecting information required to triage the issue.

Comments

@francescomikulis
Copy link

Motivation

A client of the OpenAPIGenerator was reporting an error, which in the logs appeared as a very unhelpful:
(MyClassTypeScope.(unknown context at $107abc012).MyErrorType error 0.)
It seems the this issue is caused by the fact that ServerError.underlyingErrorDescription is not falling back to String(describing: underlyingError), but using another representation that is not very useful in practice.

Proposed solution

Please consider moving the error description mechanism that surfaces the content of the underlying error to use String(describing: underlyingError) instead of the current mechanism.

Alternatives considered

Forcing all clients to conform to LocalizedError in order to get good logging for an error is error-prone.

Additional information

No response

@francescomikulis francescomikulis added kind/feature New feature. status/triage Collecting information required to triage the issue. labels Sep 18, 2024
@czechboy0
Copy link
Collaborator

Hi @francescomikulis,

yeah this is currently somewhat intentional, to prevent leaking potentially sensitive data unintentionally through logs.

That said, I am open to discussing this more and potentially reconsider.

@fabianfett, can you chime in here with your experience in this area from the Postgres client, and @FranzBusch as well maybe? cc @simonjbeaumont

@simonjbeaumont
Copy link
Collaborator

Should we have different behaviour for debug and production servers? ISTR this is how some of the web frameworks behave with regard to providing the error in the response payload.

@czechboy0
Copy link
Collaborator

Right, some do, I suspect this issue is about making the behavior consistent between transports. There is the extra consideration of the wrapping of the thrown error in a ServerError, and how those descriptions interact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature. status/triage Collecting information required to triage the issue.
Projects
None yet
Development

No branches or pull requests

3 participants