You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user tries to create a payload with a value that overflows our DB scheme the app breaks.
Example: Trying to add a payment with a total amount bigger than Int 32bits (> 2147483647).
This scenario will probably never happen (at least the one of the example) but is a way to break the app so it has to be fixed.
Let the user make the request and the using Apollo client handle the error and notify the user about it without breaking the app.
Verify on the client the value of the variables before making certain requests, if the value would cause an overflow error in the DB, use UI elements to stop the client from making the request (disabling buttons, showing error messages...)
Research
After making some tests and researching it seems that there's a bug in the apollo client framework.
Following the doumentation the expected behavior should be the one described as follows,
Setting error policy to all, should allow me to catch the response error and access to the error` object returned by the promise with the error code and the server error message.
I'm expecting to have access to those properties in the e variable
But the actual behavior is that e doesn't give access to the apollo client error object. But only returns a Network Error message. It seems that if the payload doesn't come with some data and an error status of 200 there's no access to the error object.
attempting to make a request that will cause an overflow error because of the Int size
The response of the server with the error message
Apollo throws an error without access to the error object
Conclusion
I prefer that the solution of handling the error with Apollo client because is a lot cleaner than validating every request on the client before making it, so, if there's no way to get the error object from the request maybe is worthy to take a look on Apollo error links
The text was updated successfully, but these errors were encountered:
Description
When a user tries to create a payload with a value that overflows our DB scheme the app breaks.
Example: Trying to add a payment with a total amount bigger than Int 32bits (> 2147483647).
This scenario will probably never happen (at least the one of the example) but is a way to break the app so it has to be fixed.
The MySQL data types info can be found here
Possible solutions
There are two ways of resolving this:
Research
After making some tests and researching it seems that there's a bug in the apollo client framework.
Following the doumentation the expected behavior should be the one described as follows,
Setting
error policy to
all, should allow me to catch the response error and access to the
error` object returned by the promise with the error code and the server error message.I'm expecting to have access to those properties in the
e
variableBut the actual behavior is that
e
doesn't give access to the apollo clienterror
object. But only returns aNetwork Error
message. It seems that if the payload doesn't come with some data and an error status of 200 there's no access to theerror
object.Similar problems found:
Test
error
objectConclusion
I prefer that the solution of handling the error with Apollo client because is a lot cleaner than validating every request on the client before making it, so, if there's no way to get the
error
object from the request maybe is worthy to take a look on Apollo error linksThe text was updated successfully, but these errors were encountered: