Skip to content

Commit 4a0858f

Browse files
committed
Catch exceptions only in i-interpolator.
Normal show will propagate the excpetions. Previously, exceptions were filtered in both cases, which was redundant. Also, it's good to have a way to show things that does not mask exceptions, if only to debug problems in show itself.
1 parent b3d4fd9 commit 4a0858f

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object Formatting {
2828
case arg: Showable =>
2929
try arg.show(ctx.addMode(Mode.FutureDefsOK))
3030
catch {
31-
case NonFatal(ex) => s"(missing due to $ex)"
31+
case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
3232
}
3333
case _ => arg.toString
3434
}

src/dotty/tools/dotc/printing/Showable.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ trait Showable extends Any {
2121
def fallbackToText(printer: Printer): Text = toString
2222

2323
/** The string representation of this showable element. */
24-
def show(implicit ctx: Context): String =
25-
try toText(ctx.printer).show
26-
catch {
27-
case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
28-
}
24+
def show(implicit ctx: Context): String = toText(ctx.printer).show
2925

3026
/** The summarized string representation of this showable element.
3127
* Recursion depth is limited to some smallish value. Default is

0 commit comments

Comments
 (0)