Skip to content

Commit 3508315

Browse files
stereotype441Commit Queue
authored andcommitted
[analysis_server] Fix stacktrace handling when reporting exceptions.
Changes the null check in `if (stackTrace != null && exception is! CaughtException)` from `!=` to `==`. The test was clearly intended to supply a stack trace if (a) there isn't one already, and (b) one can't be obtained from `CaughtException`. But with the accidental use of `!=`, what it was actually doing was destroying the stack trace supplied by the caller in the circumstance where `exception` was not a `CaughtException`. This should make it easier to debug some trybot failures that are occurring in https://dart-review.googlesource.com/c/sdk/+/464245. Change-Id: I6a6a6964072bf58db0bcddb22492b0a70203d43a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464460 Auto-Submit: Paul Berry <paulberry@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
1 parent 144b395 commit 3508315

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/analysis_server/lib/src/legacy_analysis_server.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ class LegacyAnalysisServer extends AnalysisServer {
829829
bool fatal = false,
830830
}) {
831831
var msg = '$message: $exception';
832-
if (stackTrace != null && exception is! CaughtException) {
832+
if (stackTrace == null && exception is! CaughtException) {
833833
stackTrace = StackTrace.current;
834834
}
835835

0 commit comments

Comments
 (0)