Regarding supertokens-web-js `supertokensEmailPass...
# support-questions
s
Regarding supertokens-web-js
supertokensEmailPassword.signUp
, is the returned promise rejected in case of FIELD_ERROR? Initially I wrote the code inside .catch to deal with FIELD_ERROR but on debugging found that the code does not reach
.catch
, but it is inside
.then
. Is it intended?
r
the promise is not rejected in that case.
the promise will be rejected only in cases of a >= 400 error status code
s
What will be the result object schema in that case?
The references mentions this
Copy code
Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>
Which means resolved -
{ fetchResponse: Response; status: "OK"; user: UserType }
rejected -
{ error: string; id: string }[]; status: "FIELD_ERROR" }
but it seems the rejected schema is also appearing in resolved state. is rejected schema same?
r
it doesn
it doesn't get rejected
they both are resolved.
s
> he promise will be rejected only in cases of a >= 400 error status code what about this?
r
im not sure how i can make this more clear. Please see the swagger API spec 🙂
s
swagger doesn't have 400 response.
anyways, let me dig around
r
you can just show a somethign went wrong message on reject. On resolve, you check the status from the body and change the UI accordingly.
4 Views