Skip to content
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

fix: do not crash when auth.authenticate call throws #100

Conversation

BOTKooper
Copy link

fixes #99

@matex1024 matex1024 self-requested a review January 18, 2023 07:17
@dziraf
Copy link
Contributor

dziraf commented Jan 18, 2023

This introduces an unhandled server exception. An error occurs inside of authenticate but it is ignored. authenticate is not AdminJS-provided function though but something you implement. You might as well put try..catch inside of your authenticate function.

By defaulting adminUser to null the UI will say that person's email/password are wrong when a server error occurs which is a bad UX. To prevent your server from crashing you can implement a global error handling middleware which will catch any unhandled exceptions from your endpoints.

https://github.com/goldbergyoni/nodebestpractices

@dziraf dziraf closed this Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If auth.authenticate throws error whole app crashes
3 participants