-
Notifications
You must be signed in to change notification settings - Fork 7
fix: remove uncaughtException listner / refactor messages file to match command name #472
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
Conversation
src/commands/apex/get/test.ts
Outdated
// process.on('uncaughtException', err => { | ||
throw SfError.wrap(messages.createError('apexLibErr', [(e as Error).message])); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the try/catch wrapper can be removed, sfCommand.catch
handles all errors here:
https://github.com/salesforcecli/sf-plugins-core/blob/main/src/sfCommand.ts#L402C1-L408C7
what if we ask apex-node to use SfError
instead of catching everything here?
that way the CLI get better errors too (IDEx team can add error.actions
if applicable, we preserve their original error.name
,etc).
// what used to be caught by the | ||
// process.on('uncaughtException', err => { | ||
throw SfError.wrap(messages.createError('apexLibErr', [(e as Error).message])); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try/catch blocks can be removed, sfError will handle these and keep the generic error.name from apex-node.
QA notes: setup: plugin compiled and linked into 403 err:
✅ command execution is included in telemetry:
❌ command error isn't included in telemetry: the telemetry payload only includes the command exec info: following this comment: I tested defining |
What does this PR do?
removes the
process.on('UncaughtException'
listener that was catching all of our errors, and then node was not re-throwing them, so we were missing information in our telemetryrefactors a command's message doc to share names
What issues does this PR fix or reference?
@W-15887232@