-
Notifications
You must be signed in to change notification settings - Fork 603
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
Improve error reporting #2376
Improve error reporting #2376
Conversation
This prevents us from accidentally giving stack traces to exceptions that don't have them and giving misleading messages telling users to use --full-stacktrace when it won't actually do anything. Also deprecate ChiselException.chiselStackTrace which is no longer being used anywhere in this codebase.
New chisel3.internal.Errors replaces old anonymous class that would show up as chisel3.internal.ErrorLog$$anon$1 in error messages.
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.
lgtm
Nice usage of info
in the tests.
@@ -61,6 +61,24 @@ case object PrintFullStackTraceAnnotation | |||
|
|||
} | |||
|
|||
/** On recoverable errors, this will cause Chisel to throw an exception instead of continuing. | |||
*/ | |||
case object ThrowOnFirstErrorAnnotation |
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.
Is this expected to be used as an annotation? If not, then this can be made private[chisel3.stage]
.
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 will be needed by chiseltest which only exposes Annotations and not arguments, but good suggestion in general
@@ -207,4 +241,53 @@ class ChiselStageSpec extends AnyFlatSpec with Matchers with Utils { | |||
exception.getStackTrace.mkString("\n") should include("java") | |||
} | |||
|
|||
it should "NOT add a stack trace to an exception with no stack trace" in { | |||
val exception = intercept[java.lang.Exception] { | |||
(new ChiselStage).emitChirrtl(new UserExceptionNoStackTrace) |
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.
Nit: only elaborate
should be needed here (though there is no cost to using emitChirrtl
.
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 seems that class ChiselStage
doesn't have elaborate
🤦♂️
This tells Chisel not to aggregate recoverable errors but instead to throw an exception on the first one. This gives a stack trace for users who need it for debugging.
2abff61
to
fc9f401
Compare
* Do not trim stack traces of exceptions with no stack trace This prevents us from accidentally giving stack traces to exceptions that don't have them and giving misleading messages telling users to use --full-stacktrace when it won't actually do anything. Also deprecate ChiselException.chiselStackTrace which is no longer being used anywhere in this codebase. * Add exception class for multiple-errors reported New chisel3.internal.Errors replaces old anonymous class that would show up as chisel3.internal.ErrorLog$$anon$1 in error messages. * Add new option --throw-on-first-error This tells Chisel not to aggregate recoverable errors but instead to throw an exception on the first one. This gives a stack trace for users who need it for debugging. (cherry picked from commit ff2e9c9)
* Improve error reporting (#2376) * Do not trim stack traces of exceptions with no stack trace This prevents us from accidentally giving stack traces to exceptions that don't have them and giving misleading messages telling users to use --full-stacktrace when it won't actually do anything. Also deprecate ChiselException.chiselStackTrace which is no longer being used anywhere in this codebase. * Add exception class for multiple-errors reported New chisel3.internal.Errors replaces old anonymous class that would show up as chisel3.internal.ErrorLog$$anon$1 in error messages. * Add new option --throw-on-first-error This tells Chisel not to aggregate recoverable errors but instead to throw an exception on the first one. This gives a stack trace for users who need it for debugging. (cherry picked from commit ff2e9c9) * Waive MiMa false positives The waived change is to a package private constructor. Co-authored-by: Jack Koenig <koenig@sifive.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…#2376) * Demonstrate a couple failing cases * Have TopWiring ignore unnamed declarations as potential sources
Inspired by @oharboe's comments here: ucb-bar/chiseltest#501 (comment).
This gives a little bit of refinement to error reporting.
$$anon$1
in the error message--throw-on-first-error
to give users the option to throw exceptions instead of aggregating recoverable errorsContributor Checklist
docs/src
?Type of Improvement
API Impact
This changes how errors are reported to make them a little more clear
Backend Code Generation Impact
No impact
Desired Merge Strategy
Release Notes
Improve recoverable error reporting and add
--throw-on-first-error
for throwing exceptions instead of aggregating recoverable errors.Reviewer Checklist (only modified by reviewer)
3.4.x
, [small] API extension:3.5.x
, API modification or big change:3.6.0
)?Please Merge
?