You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/01/29 18:51:20 UTC

[GitHub] stevedlawrence commented on a change in pull request #176: Add better error message for '/' vs 'div'

stevedlawrence commented on a change in pull request #176: Add better error message for '/' vs 'div'
URL: https://github.com/apache/incubator-daffodil/pull/176#discussion_r251967995
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dpath/DFDLExpressionParser.scala
 ##########
 @@ -157,7 +157,14 @@ class DFDLPathExpressionParser[T <: AnyRef](qn: NamedQName,
           nextRdr = nextRdr.rest
           i += 1
         }
-        context.SDE("Unable to parse expression. Message: %s\nNext: %s.", msg, nextString.toString())
+        val err_msg = {
+          if (msg.contains('/')) {
+            msg + ", did you mean to use 'div'?"
+          } else {
 
 Review comment:
   This feels pretty fragile to me, and could potentially give a lot of false negatives if there's some error message that uses a /, like maybe a path expression. Perhaps an alternative approach would be to modify the MultiplicativeExpr grammar to accept a /, but then call context.SDE() if it matches? We do similar things for `//`` in a path expression. Not sure if there might be some ambiguities and adding that might make normal paths (i.e. ``/foo/bar/baz``) look like errors in some cases, though.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services