From d387a31ac2f3fa6165630ec16f08635c68516355 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 26 Nov 2024 11:19:06 +0100 Subject: [PATCH] Robust again IllegalArgumentException --- .../runtime/util/DiagnosticFormatter.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/runtime/src/main/scala/org/enso/interpreter/runtime/util/DiagnosticFormatter.scala b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/util/DiagnosticFormatter.scala index 41ea90390e65..5ff35de50c1f 100644 --- a/engine/runtime/src/main/scala/org/enso/interpreter/runtime/util/DiagnosticFormatter.scala +++ b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/util/DiagnosticFormatter.scala @@ -169,9 +169,15 @@ class DiagnosticFormatter( endCol: Int ): String = { val line = source.createSection(lineNum).getCharacters.toString - linePrefix(lineNum) + fansi - .Str(line) - .overlay(textAttrs, startCol - 1, endCol) + val suffix = + try { + fansi + .Str(line) + .overlay(textAttrs, startCol - 1, endCol) + } catch { + case _: IllegalArgumentException => line + } + linePrefix(lineNum) + suffix } private def linePrefix(lineNum: Int): String = {