joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
228 stars 56 forks source link

Update BaseAuthResolver.php to gracefully handle errors without an "error" key #137

Closed MarkASwanson closed 3 years ago

MarkASwanson commented 3 years ago

Currently, when a json response without an "error" key is returned by the app, graphql throws an error with:

"debugMessage": "Undefined array key \"error\"",
"message": "Internal server error",

This change would more gracefully handle a wider range of app errors that sometimes have a "message" key and not an "error" key (for example, when the app can't connect to the database).

joselfonseca commented 3 years ago

Thanks @MarkASwanson and sorry it took so long to merge. I think this PR is fine and should be merged.