mbeckerle commented on a change in pull request #204: Provide more detail for failed assertions URL: https://github.com/apache/incubator-daffodil/pull/204#discussion_r270942795
########## File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/AssertPatternParsers.scala ########## @@ -75,7 +76,9 @@ class AssertPatternParser( val isMatch = dis.lookingAt(m, start) if (!isMatch) { val message = getAssertFailureMessage(start) - val diag = new AssertionFailed(context.schemaFileLocation, start, message) + val currentElem = start.infoset + val details = "\nParsed value was: " + currentElem.toString + val diag = new AssertionFailed(context.schemaFileLocation, start, message, Some(details)) Review comment: Instead of Some(details), which is scala's Option type, which requires allocation of an object, can you use One(details), a Maybe type, which doesn't allocate? For this to work and not allocate it can't be a varargs list at the end of the AssertionFailed constructor. Has to be a specific argument of that type. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services