How to do exception logging? #5927
Unanswered
TonyK-FmGroup
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
We're quite new to GraphQL and to this library. Thanks to the authors the journey is easier than we expected!
The problem we have is that we need to ensure that exceptions are logged on application insights for monitoring / debug purposes. We're trying to find where to perform this logging but everywhere we've found so far seems to also see errors the same as exceptions as if the two have become conceptually the same thing.
To align on terminology, we describe an error something that can be reasonably expected, for example some validation error (quantity must be > 0), or some business logic needing to return some sort of error code (for example, product out of stock). The kind of thing we might want to report with ResolverContext.ReportError().
An exception, is, well, exceptional. Something which may not be expected during the 'normal' operation of the system. For example, a DB server being unreachable or an out of memory exception.
We see that the GraphQL spec says we should still return a HTTP 200 and return an error in the response body and we're fine with that.
What we need to achieve is a clear understanding of what is being returned as an error and what is a true exception, so that we can log and alert hen exceptions start to pop up.
Any suggestions will be gratefully appreciated!
Tony
Beta Was this translation helpful? Give feedback.
All reactions