You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "mbeckerle (via GitHub)" <gi...@apache.org> on 2023/06/15 18:05:51 UTC

[GitHub] [daffodil-vscode] mbeckerle commented on a diff in pull request #663: Throw parse errors

mbeckerle commented on code in PR #663:
URL: https://github.com/apache/daffodil-vscode/pull/663#discussion_r1231375742


##########
server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala:
##########
@@ -97,12 +100,22 @@ object Parse {
 
             val parse =
               IO.interruptibleMany {
-                dp.parse(
+                val parse_res = dp.parse(
                   new InputSourceDataInputStream(data),
                   infosetOutputter
-                ) // WARNING: parse doesn't close the OutputStream, so closed below
-              }.guaranteeCase(outcome => Logger[IO].debug(s"parse finished: $outcome"))
-                .void
+                )
+
+                parse_res.isError match {
+                  case true =>
+                    throw new Error(
+                      parse_res.getDiagnostics
+                        .map(d => d.toString)
+                        .mkString

Review Comment:
   Do you have an option to mkstring for putting a "\n" between the diagnostic messages? 
   Alternatively your d => d.toString can append a "\n" to the end of the string. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org