Skip to content

Commit 70ab8bb

Browse files
authored
Skip logging stack traces of an Exception. (#4040)
1 parent cc43f83 commit 70ab8bb

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

build_runner/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## 2.5.1-wip
22

3-
- Don't show stack traces if a generator throws `InvalidGenerationSourceError`
4-
from `source_gen`.
3+
- Don't log stack traces for subclasses of `Exception`.
54

65
## 2.5.0
76

build_runner_core/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## 9.0.1-wip
22

3-
- Don't show stack traces if a generator throws `InvalidGenerationSourceError`
4-
from `source_gen`.
3+
- Don't log stack traces for subclasses of `Exception`.
54

65
## 9.0.0
76

build_runner_core/lib/src/logging/build_log.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import 'dart:async';
66
import 'dart:math';
77

8-
import 'package:build/build.dart'
9-
show AssetId, SyntaxErrorInAssetException, UnresolvableAssetException;
8+
import 'package:build/build.dart' show AssetId;
109
// ignore: implementation_imports
1110
import 'package:build_runner/src/internal.dart';
1211
import 'package:logging/logging.dart';
@@ -414,8 +413,7 @@ class BuildLog {
414413

415414
/// Renders [message] with optional [error] and [stackTrace].
416415
///
417-
/// Drops `build_runner` exceptions that can be caused by normal user input:
418-
/// [SyntaxErrorInAssetException] and [UnresolvableAssetException].
416+
/// Skips rendering [stackTrace] if [error] is an [Exception].
419417
String renderThrowable(
420418
Object? message, [
421419
Object? error,
@@ -427,11 +425,7 @@ class BuildLog {
427425
result += '$error';
428426
}
429427

430-
if (stackTrace != null &&
431-
error is! SyntaxErrorInAssetException &&
432-
error is! UnresolvableAssetException &&
433-
// From `source_gen`, use the name to avoid a build dependency.
434-
error.runtimeType.toString() != 'InvalidGenerationSource') {
428+
if (stackTrace != null && error is! Exception) {
435429
result += '\n$stackTrace';
436430
}
437431
return result;

0 commit comments

Comments
 (0)