Inconsistent error response from user login mutations


I have asked about this before and maybe I was not clear enough in my question. When using the userLogin, userPasswordForgotConfirm and userSignUpWithPassword mutations, they all have different error responses. I give examples:

userLogin (user does not exits)
{"data":{"__typename":"Mutation","userLogin":null},"errors":[{"message":"The request is invalid.","locations":[{"line":3,"column":3}],"path":["userLogin"],"code":"ValidationError","details":{"password":"Incorrect email or password"}}]}

userSignUpWithPassword (invalid password)
{"data":null,"errors":[{"message":"Unexpected error value: { code: \"InvalidPasswordException\", name: \"InvalidPasswordException\", message: \"Password did not conform with policy: Password must have lowercase characters\" }","locations":[{"line":3,"column":3}],"path":["userSignUpWithPassword"]}]}

and finally

userPasswordForgotConfirm (invalid code)
{"data":{"__typename":"Mutation","userPasswordForgotConfirm":null},"errors":[{"message":"Unexpected error value: { code: \"CodeMismatchException\", name: \"CodeMismatchException\", message: \"Invalid verification code provided, please try again.\" }","locations":[{"line":3,"column":3}],"path":["userPasswordForgotConfirm"]}]}

Here we have three error bodies from the same api and they are all wildly different. This makes it difficult to parse the response as you’ll need a custom parser for each body. The first is well formed. The second one has no data in its response (which caused our library to fail and we needed to create a custom parser for that) it also has a json code structure in the message field (this it is supposed to be a message field and then a value field). The final message has a data field but contains a json structure in the message field.

Please try to streamline this and make it consistent as these are useful and contain information which the user needs to know.



Thanks for your suggestion!
I’ll discuss it with our team and let you know soon.

Lada Kokotova | Technical Support Engineer