-
Notifications
You must be signed in to change notification settings - Fork 16
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
Improved error catching and logging #343
Conversation
FYI, we'll probably respond with a 410 (that's what we return right now on account disablement). |
src/lib/fauna-command.js
Outdated
} else if ( | ||
err.description === "UnknownError" && | ||
err?.requestResult?.statusCode === 410 && | ||
version === "4" | ||
) { | ||
this.error( | ||
`This account is not allowed to query Fauna v4. Please use the v10 endpoint.` | ||
); | ||
} else { | ||
this.error(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems error prone, in that it assumes all unknown 410 errors are due to v4 being disabled. I think you should be able to get access to more error details via requestResult rather than relying on heuristics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ashton and I tested locally and found no reason not to just forward the nice message from core: https://github.com/fauna/core/blob/33ae43bb9aeabdea0f596020b0514975020dcf9b/ext/api/src/main/scala/api/ExceptionResponseHelpers.scala#L68
Updated this block to just properly handle description
and message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this looks like a much better approach!
Ticket(s): FE-5448
Problem
Solution
err.message
anderr.description
from fauna. This will display the nice message from core regarding v4 accesseval
will properly catch errors from the asyncwrapQueries
blockResult
Testing