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
Handle exception during signing up #50
Comments
Hi! Thanks for pointing this out - there is indeed a slight error in the Readme. requestToken has a fourth parameter which is the req object. See also the example at https://passwordless.net/docs/Passwordless.html#requestToken Florian |
Thanks for the quick response. Is it possible to use req object in addDelivery? Cause I feel it is difficult to handle delivery exception in requestToken level. |
req is not available in addDelivery and I wouldn't feel comfortable adding it there. Delivery issues should be very rare (e.g. most email layers will not inform you at that level about failed delivery). Errors occurring at this level are mostly network issues, authentication issues with your email provider, etc. and should hence be escalated more strongly as the user will not be able to do anything about them. requestToken will call next(error) in case of an error in the delivery layer and you could catch that if needed. What is your delivery layer? |
I am using mailjs and in any case, the mail server throws "timedout while connecting to smtp server". If it is not handled properly anyway, user will try to signup again and actually system already created a profile for that. Thanks. |
Hi! This error looks like something that shouldn't be happening in production, though, (except something went really wrong) as is basically means mailjs couldn't contact your own SMTP server (from what I understand). If you really need to catch the error I'd use the regular Express way of handling errors passed by next(err). I don't quite see the problem of the user profile being created. Isn't that the idea of the signup? If your own mail server is not available I feel it would be strange to deny the user his user profile... With the next login (provided your server runs again) the user should get his login email. Edit: documentation has been updated |
Yes. I get your point. Right now, system successfully create users profile and handled mail exception through UI. In this case, user will try to signup again. I think it might be wrong, instead ask user to signup again, system should try to resend the token a couple of seconds later. There always is a case user may not get the token in time, then system allows user to re-request it through another workflow. I guess this is a design issue. |
Hi, I have a signup form with some more fields except for email/user, I need to persist those information when mailing is successfull. Should it be handled in addDelivery() or requestToken()? I prefer to do that in addDelivery(), however req.body is not exposed? but if using requestToken() method, then how to handle mailing exception?
The text was updated successfully, but these errors were encountered: