Skip to content

Commit ca7f881

Browse files
authored
Always log stack traces for Error objects (#3586)
Closes #3585 The default logging omits stack traces by default and prints them only in verbose mode. This is intended to allow builder implementations to cease execution and log a user friendly message by throwing a single `Exception` with a custom `toString()`. When a builder or utility library has an implementation bug leading to an `Error` the stack trace is much more likely to be useful information for debugging, and worth including by default.
1 parent 80b6526 commit ca7f881

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

build_runner/CHANGELOG.md

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

33
- Update README.md to point to the FAQ and other docs.
4+
- Print stack traces for `Error` subtype exceptions in non-verbose mode.
45

56
## 2.4.7
67

build_runner/lib/src/logging/std_io_logging.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ StringBuffer colorLog(LogRecord record, {required bool verbose}) {
3333
lines.add(record.error!);
3434
}
3535

36-
if (record.stackTrace != null && verbose) {
36+
if (record.stackTrace != null && (verbose || record.error is Error)) {
3737
var trace = Trace.from(record.stackTrace!);
3838
const buildSystem = {'build_runner', 'build_runner_core', 'build'};
3939
if (trace.frames.isNotEmpty &&

0 commit comments

Comments
 (0)