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

Why in node-runer js there is no catch in promise? #5

Open
aspirisen opened this issue Apr 18, 2024 · 3 comments
Open

Why in node-runer js there is no catch in promise? #5

aspirisen opened this issue Apr 18, 2024 · 3 comments

Comments

@aspirisen
Copy link

Here https://github.com/bridgetownrb/node-runner/blob/master/lib/node_runner.js#L3
image

We have wrapper try-catch block.
But is there any specific reason why Promise.resolve() doesn't have catch clause?

@jaredcwhite
Copy link
Member

@aspirisen Honestly not sure! What should happen in a catch clause here? 🤔

@aspirisen
Copy link
Author

@jaredcwhite I think it should have same stdout log

process.stdout.write(JSON.stringify(['err', '' + err, err.stack]))

Because func call is not awaited then try catch block doesn't handle the error
image

With await
image

With catch clause
image

@aspirisen aspirisen changed the title Why in node-runer js there is not catch in promise? Why in node-runer js there is no catch in promise? Apr 18, 2024
@jaredcwhite
Copy link
Member

@aspirisen OK, that makes sense to me. Could you make that fix in a PR and I'll merge? TY!

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

No branches or pull requests

2 participants