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
const assert = require('assert');
assert(false, 'something was missing');
But of course, if you do that inside a graphql-errors call that error will get masked. If you want to assert in a way that shows the user what went wrong you need to make your own assert:
Obviously it's not a big deal to write the above function yourself, but since it's basically just a one-liner I thought it might be nice if such a method was provided as a convenience by the library:
const { assertUserError } = require('graphql-errors');
assertUserError(false, 'something was missing');
If you think such a function is within the library's scope I'd be happy to provide a PR.
The text was updated successfully, but these errors were encountered:
Currently without
graphql-errors
one can do:But of course, if you do that inside a
graphql-errors
call that error will get masked. If you want to assert in a way that shows the user what went wrong you need to make your ownassert
:Obviously it's not a big deal to write the above function yourself, but since it's basically just a one-liner I thought it might be nice if such a method was provided as a convenience by the library:
If you think such a function is within the library's scope I'd be happy to provide a PR.
The text was updated successfully, but these errors were encountered: