You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "olabusayoT (via GitHub)" <gi...@apache.org> on 2023/08/01 20:27:03 UTC
[GitHub] [daffodil] olabusayoT commented on a diff in pull request #1058: Better Error Reporting for Library API
olabusayoT commented on code in PR #1058:
URL: https://github.com/apache/daffodil/pull/1058#discussion_r1281119790
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/api/Diagnostic.scala:
##########
@@ -308,4 +308,12 @@ trait WithDiagnostics {
* then one can proceed to run the compiled entity.
*/
def isError: Boolean
+
+ /**
+ * Helper method to check that isError is false, if not it throws
+ * a usage error caused by illegal state caused by a compilation error
+ */
+ def checkNotError(): Unit = {
+ Assert.usage(!isError, new IllegalStateException(getDiagnostics.find(_.isError).get))
Review Comment:
How's changing the definition to
```scala
def checkNotError(): Unit = {
Assert.usage(!isError, new IllegalStateException(
"Must call isError() to ensure there are no errors",
getDiagnostics.find(_.isError).get,
))
}
```
--
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