-
Notifications
You must be signed in to change notification settings - Fork 11
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
Error handling #5
Comments
I will look into that once I'm chanced. In the meantime you can send PR to this effect. |
I can do it, I am just not sure I am right with my assumptions. I am new to Adonis. |
@ammezie Heads Up: I guess you need to wait for AdonisJS v4.1 which is a breaking changes for exceptions. Reference: adonisjs/core#718 |
Alright. Thanks for pointing that out. |
Hi, Does anyone have and example of how to handle errors? Ex. resolve: async (root, { input }, context) => {
const rules = { email: 'required|email|unique:users' }
const validation = await validate(input, rules)
console.log(validation)
if (validation.fails()) {
throw new Error('Test')
}
return await User.create(input)
}
Thanks! |
@moltar still working on a PR on this? Want to know so as to avoid duplicate efforts. |
@ammezie No, not working on this. |
It appears that error handling is broken. The HTTP status is returned in
statusCode
attribute, rather thanstatus
for errors coming from GraphQL middleware.adonis-apollo-server/src/ApolloServer/index.js
Line 38 in d28426c
But, on top of that, I am questioning the need to handle errors there at all. Why not just let the error bubble up and be dealt with by an exceptions handler (
app/Exceptions/Handler.js
), which does need to be user-defined, but maybe add instructions for that.The text was updated successfully, but these errors were encountered: