-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to display cusom error messages #800
Comments
Hi @nicitaacom, it appears that the link to your github repo is broken, can you please paste the correct link to the code snippet so that we can investigate further? |
I corrected it - thank you for your interest in this issue |
@nicitaacom thanks for updating the link! what is the value of if ((error as { code?: string })?.code === "23505") {
displayResponseMessage(<p className="text-danger">This user already exists</p>)
} |
its value for error code |
Please avoid using |
Provide code please Do you mean instead if (error instanceof AuthError) { use if (error instanceof isAuthError) { |
@nicitaacom he meant use this instead. if (isAuthError(error)) {
...
} As for customising error messages for Auth, I don't think it's possible as of now. The closest thing I could find was Auth Hooks, but I don't think this does what you'd want, plus it doesn't come free. |
@kangmingtay this would be a nice feature though (not sure if it's already open somewhere). Currently for Supabase API calls, you can throw exceptions using trigger functions to add validations (Ex: If a user tries to add an invalid record, you can create a trigger to check the record and raise an exception). ~ More info I tested this by inserting data into a public table, and I got a proper error message and status code (the same as the one's I set). However, this doesn't work for auth requests (Ex: I'm currently planning to write a Deno wrapper function around the |
Bug report
Yes because previously I did smth like this and it worked
Describe the bug
No way to handle login/register errors with
I use Next 13.5 + TypeScript
To Reproduce
Its not minimal example becasue codesadbox doesn't work in vs code and I have error making codesandbox as public (support ignores me) - to do something with issue just create supabase example how to display custom error messages when login (you can make sure that its doesn't work if you make
git cline
andpnpm dev
- then try to signUp with [email protected] email (this email already exist and it thow no relevat/customizable error message)https://github.com/nicitaacom/23_store/blob/development/app/components/ui/Modals/AuthModal/AuthModal.tsx
173 line
Expected behavior
When I write code above - nothing happening but in dev tools console I got the error
System information
The text was updated successfully, but these errors were encountered: