Skip to content

Commit

Permalink
Update CodingActor.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Dec 2, 2023
1 parent 752dfe7 commit 56f887a
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ open class CodingActor(
|${workingCode}
|```
|
|```text
|${ex.message}
|```
""".trimMargin().trim(), workingCode
)
log.info("Validation failed - ${ex.message}")
Expand Down Expand Up @@ -427,10 +429,12 @@ open class CodingActor(

fun errorMessage(ex: ScriptException, code: String) = try {
"""
|${ex.message ?: ""} at line ${ex.lineNumber} column ${ex.columnNumber}
| ${code.split("\n")[ex.lineNumber - 1]}
| ${" ".repeat(ex.columnNumber - 1) + "^"}
""".trimMargin().trim()
|```text
|${ex.message ?: ""} at line ${ex.lineNumber} column ${ex.columnNumber}
| ${if(ex.lineNumber > 0) code.split("\n")[ex.lineNumber - 1] else ""}
| ${if(ex.columnNumber > 0) " ".repeat(ex.columnNumber - 1) + "^" else ""}
|```
""".trimMargin().trim()
} catch (_: Exception) {
ex.message ?: ""
}
Expand Down

0 comments on commit 56f887a

Please sign in to comment.