stevedlawrence commented on a change in pull request #273: WIP: Add User Defined Functions Capability URL: https://github.com/apache/incubator-daffodil/pull/273#discussion_r331473046
########## File path: daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala ########## @@ -1870,6 +1871,47 @@ case class FunctionCallExpression(functionQNameString: String, expressions: List case (RefQName(_, "unsignedByte", XSD), args) => XSConverterExpr(functionQNameString, functionQName, args, NodeInfo.UnsignedByte) + case (RefQName(Some(_), _, _), args) => { + val namespace = functionQName.namespace.toString() + val fName = functionQName.local + + lazy val udfservice = { + val a = UDFService + a.warnings.map { w => SDW(WarnID.UserDefinedFunction, w) } + val allErrors = a.errors.mkString("\n\n") + SDE(s"Function unknown: fname[${fName}] fnamespace[${namespace}].\n$allErrors") + a + } Review comment: Could you use a more descriptive variable name other than "a"? Also, I think everytime a UDF is called it will output the warnings. Which means we could get multiple duplicate warnings. Maybe udfservice needs to be a member variable so that it is only ever initialized once, and thus these warnings will only ever appear once? Also, the error here says function unknown. But the function name/namespace hasn't been provided to the UDFService here, so it seems it can't know that the function is unknown here. Is "function unknown" the correct error message? And rather than fname[] namespace[], it would probably be more consistent to display it as a user would call it, e.g. "namespace:fname". ---------------------------------------------------------------- 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