The SuperTokens backend APIs are supposed to let u...
# support-questions-legacy
i
The SuperTokens backend APIs are supposed to let us know if the response didn't turn out okay, right? Will it let us know through the
response.status
? Or do we have to find out from the
response.json().status
? (Stated differently, is there a way to know that an error occurred without JSON-ing the response?)
r
hey! if the API throws a 500 error, it will be reflected in the HTTP status code of the response.
i
Okay. Does that mean 400 errors will be left to the
json
body?
r
Nope. 400 as well will he http status code. You should check the json body only if the status code is 200
i
That is indeed odd. 🤔 Maybe it's how I'm making the request? Whenever I get the response back from SuperTokens, the
status
for a
fetch
always seems to be
200
. I've been having to do
await response.json()
to check the
status
property on the JSON object (to know if there was an error or not)
r
Well. The json body also had a status property which indicates what happened in the API
If there are non 200 status code result, it means your input was invalid in the API, or that something like a db connection went wrong etc.
Vs if the http status is 200, but the status in the json body is not OK, then it means that the API ran fine, it’s just a user error than happened. L
i
Ahhhhh okay. That makes more sense. Thanks