-
Notifications
You must be signed in to change notification settings - Fork 14
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
snyk: append the error text to thrown errors #13
Conversation
lib/index.js
Outdated
@@ -37,7 +37,7 @@ function inspect(root, targetFile, options) { | |||
if (thrownError) { | |||
throw thrownError; | |||
} | |||
throw new Error('An unknown error occurred.'); | |||
throw new Error('snyk-sbt-plugin error: ' + error); |
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.
Converting an error to a string will only keep its message
. How about just throw error;
to keep the stack-trace etc.?
Also, how will the CLI behave on a standard error being thrown by the plugin?
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 CLI will just print the message and quit (without the stacktrace)
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.
b.t.w the existing code assumes the error is a string ..
efb057c
to
6317c93
Compare
instead of current 'An unknown error occurred.' when e.g. `sbt` in not in the PATH
6317c93
to
ebf08c3
Compare
if (thrownError) { | ||
throw thrownError; | ||
} | ||
throw new Error('snyk-sbt-plugin error: ' + error); |
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.
I'd do throw (thrownError ? thrownError : new Error('snyk-sbt-plugin error: ' + error));
, but I'm weird.
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.
🙈 it becomes longer than 80 chars so I'll stick with my verbose version 😅
instead of current 'An unknown error occurred.' when e.g.
sbt
is not in the PATH