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

Parse App errors from CloudExecutables that use sub-shell #32997

Open
mrgrain opened this issue Jan 17, 2025 · 0 comments
Open

Parse App errors from CloudExecutables that use sub-shell #32997

mrgrain opened this issue Jan 17, 2025 · 0 comments

Comments

@mrgrain
Copy link
Contributor

mrgrain commented Jan 17, 2025

Errors thrown by CDK Apps are just printed to stdout/stderr by the subprocess. we should intercept, capture and re-throw the error. Instead this should be thrown by toolkit.synth directly.

We need to pass a magic env variable CDK_SERIALIZE_ERRORS to the cdk app. When this variable is set, then we add the following snippet:

process.on('uncaughtException', function(err) {
  // do magic here, e.g.
  console.error('Caught exception: ' + err);
});

This needs to somehow announce to the parent process that the app is no sending a JSON serialized error through the channel.

In the CLI/Toolkit we need to detect this and NOT print regularly. Instead we deserialize the error, recreate it to a proper Node exception and re throw it (toolkit). In the CLI we can also add some nice formatting on the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant