From 4fd1ff900c0ea1b44759994047f76d0ba099ee90 Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Fri, 20 Sep 2024 21:47:37 +0200 Subject: [PATCH] Make stack traces optional --- src/core/exceptions.scala | 6 +++--- src/core/xmlparser.scala | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/exceptions.scala b/src/core/exceptions.scala index e0e2ddd..67b4bb2 100644 --- a/src/core/exceptions.scala +++ b/src/core/exceptions.scala @@ -19,11 +19,11 @@ package xylophone import fulminate.* import gossamer.* -case class XmlParseError(line: Int, column: Int) +case class XmlParseError(line: Int, column: Int)(using Diagnostics) extends Error(m"the XML source could not be parsed at line $line, column $column") -case class XmlReadError() extends Error(m"could not read value") +case class XmlReadError()(using Diagnostics) extends Error(m"could not read value") -case class XmlAccessError(index: Int, path: XmlPath) +case class XmlAccessError(index: Int, path: XmlPath)(using Diagnostics) extends Error(m"""could not access ${if index == 0 then t"any nodes" else t"node $index"} at path ${Xml.pathString(path)}""") diff --git a/src/core/xmlparser.scala b/src/core/xmlparser.scala index a586110..3a8ba78 100644 --- a/src/core/xmlparser.scala +++ b/src/core/xmlparser.scala @@ -25,6 +25,8 @@ import contingency.* import gossamer.* import spectacular.* +import exceptionDiagnostics.empty + object XmlInterpolation: enum XmlInput: