Skip to content

Exception message repeats text of inner exception message #867

Description

@alekdavis

The endpoint my code is calling has a problem, so it is returning a 501 response. All is fine, except the error message in the Flurl exception could be better. One problem is that there seems to be a formatting error with the error message in the system exception (it ends with a quote for some reason). But I also noticed that Flurl repeats the inner exception's error message in its own error message. This adds redundant text coupled with bad formatting making it look bad.

Here are some details (with endpoint info masked):

Flurl.Http.FlurlHttpException message:

Call failed. The proxy tunnel request to proxy 'https://endpointurl' failed with status code '501'.": GET endpointurl?querystring

Inner exception message (System.Net.Http.HttpRequestException)

The proxy tunnel request to proxy 'https://endpointurl' failed with status code '501'."

I don't think there is a good way to fix the double quote (must be Microsoft's problem), but I am wondering if repeating the message from the inner exception is a good practice. In my code I normally go down the exception stack and combine error messages from inner exceptions to get the full error context, so if every exception repeats error messages of every inner exception, it would be a mess.

Stack trace of the FlurlHttpException:

   at Flurl.Http.FlurlClient.<HandleExceptionAsync>d__28.MoveNext()
   at Flurl.Http.FlurlClient.<SendAsync>d__23.MoveNext()
   at Flurl.Http.FlurlClient.<SendAsync>d__23.MoveNext()
   at Flurl.Http.ResponseExtensions.<ReceiveJson>d__0`1.MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions