hoodiehq / hoodie-account-client

:dog: Account client API for the browser
https://hoodiehq.github.io/hoodie-account-client
Apache License 2.0
11 stars 24 forks source link

handle unexpected 404s in utils/request.js #101

Open gr2m opened 8 years ago

gr2m commented 8 years ago

in utils/request.js, we expect response.body to be an object with a errors array property. In some circumstances there might be an issue with that, and we should add a check if response.body.errors exists and if it doesn’t, response.body can be a string like Not found: /hoodie/account/api/session/account.

gr2m commented 8 years ago

It should probably return a generic connection error saying that the account backend cannot be reached, as clearly the server does not respond as expected

thomasjinlo commented 7 years ago

Hey I would like to tackle this issue and was looking into this. I was wondering if there is a way to reproduce this error message?

gr2m commented 7 years ago

Hey @thomasjinlo, unfortunately not, it’s been a while. You could probably simulate it with a test in which you mock a server response. Problem are these lines: https://github.com/hoodiehq/hoodie-account-client/blob/9b22171/utils/request.js#L26-L29

We don’t check if response.body.errors actually exists.