fsprojects / FSharp.Data.GraphQL

FSharp implementation of Facebook GraphQL query language.
http://fsprojects.github.io/FSharp.Data.GraphQL/
MIT License
395 stars 72 forks source link

Improving server exception logging by including exception in log message #471

Closed valbers closed 2 months ago

valbers commented 2 months ago

There were two problems before:

  1. The error message itself was not being logged, but only a mention that there was an error;
  2. It was not possible to access the possibly original exception which led to the request processing error. However, it's extremely useful to log the error with the whole exception information including the stack trace of where the exception was thrown.

Before

before-srv-ex-logging

After

after-srv-ex-logging

However, these changes also introduce a breaking change as GQLProblemDetails now has an additional member holding the possible exception which generated the error.

GQLProblemDetails is public and could be in use by code using FSharp.Data.GraphQL.

valbers commented 2 months ago

@xperiandri I rewrote my changes according to your suggestion regarding the extra interface. Please kindly review the current changes.

valbers commented 2 months ago

@xperiandri there's a commit for applying fantomas formatting to HttpHandlers.fs but I find it suspicious. Do you have an idea why the formatting is so different now?

valbers commented 2 months ago

@xperiandri waiting for your approving review.

xperiandri commented 2 months ago

Cool! Lots of thanks for the contribution!