-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Reserve promise rejections (i.e. async exceptions) for exceptional circumstances #485
Comments
Please go ahead with a PR 🚀 |
Excellent! Using TypeScript, I've already had this problem. We should also keep that issue somewhere in our mind for the next major, to enable the new behaviour by default (and maybre remove the option and related code). |
@limonte @toverux Does the same go with the API for the The control-flow is not as bad here, but I think in principal we should not mix user errors with actual technical/system errors. |
It makes it difficult to debug actual errors thrown inside the function. Also, if there are any errors in production, I want them bubbled up to Rollbar error reporting. Same goes for rejections in That said, to support validations for the "multiple-input" scenario, could we always call the function, even if |
Both of your comments make sense. But for beginning please implement the scope of the initial comment only. After reviewing and testing I will be able to decide what to do next. Thanks @mattbrunetti ! |
|
@zenflow Beautiful, readable and maintainable code! Love it! |
Uncaught SyntaxError: await is only valid in async function |
rude answer to rude message: https://gist.github.com/Rich-Harris/0b6f317657f5167663b493c722647221 |
With the browser's native
prompt
function, pressing cancel doesn't result in an error, but instead anull
return value. (Similarly, with the nativealert
function, hitting escape doesn't result in an error, and with the nativeconfirm
function, clicking no doesn't result in an error but instead a false return value.)I believe this to be the desired behavior. Especially when using the up-coming async/await feature of ES (being used already via Babel), the current swal2 behavior leads to some awkward control-flow...
The following would be a bit nicer.
@limonte Would you review a PR adding an option to enable this behavior? Let's call the option
rejections
and have it default totrue
?The text was updated successfully, but these errors were encountered: