aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/Reporter.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/reporting/Reporter.scala')
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index 723af8768..dac2b6874 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -36,15 +36,26 @@ trait Reporting { this: Context =>
value
}
- def traceIndented[T](leading: => String, trailing: => String)(op: => T): T =
+ def traceIndented[T](leading: => String, trailing: => String)(op: => T): T = {
+ var finalized = false
+ def finalize(note: String) =
+ if (!finalized) {
+ base.indent -= 1
+ log(s"${base.indentTab * base.indent}$trailing$note")
+ finalized = true
+ }
try {
log(s"${base.indentTab * base.indent}$leading")
base.indent += 1
op
+ } catch {
+ case ex: Throwable =>
+ finalize(s" (with exception $ex)")
+ throw ex
} finally {
- base.indent -= 1
- log(s"${base.indentTab * base.indent}$trailing")
+ finalize("")
}
+ }
}
object Reporter {