Exception messages
Added by Anonymous over 15 years ago
Legacy ID: #6626293 Legacy Poster: zohar (zohar_amir)
Hello, I'm using Saxon as an XSLT engine. While I was transforming I got the following exception: ----------------------8<---------------------------------- Caused by: net.sf.saxon.trans.DynamicError: Cannot convert string "" to xs:decimal at net.sf.saxon.expr.Expression.dynamicError(Expression.java:780) at net.sf.saxon.expr.CastExpression.evaluateItem(CastExpression.java:302) at net.sf.saxon.expr.CastExpression.evaluateItem(CastExpression.java:278) at net.sf.saxon.expr.CastExpression.evaluateItem(CastExpression.java:278) at net.sf.saxon.expr.Expression.process(Expression.java:339) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ForEach.processLeavingTail(ForEach.java:243) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:405) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:98) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317) at net.sf.saxon.Controller.transformDocument(Controller.java:1705) at net.sf.saxon.Controller.transform(Controller.java:1513) ... ----------------------8<---------------------------------- Is there any way to get a more verbose exception message (for example line and column where this error occurred)? Thanks, Zohar.
Replies (1)
RE: Exception messages - Added by Anonymous over 15 years ago
Legacy ID: #6631707 Legacy Poster: Michael Kay (mhkay)
Saxon will have sent a more explicit message to the ErrorListener, and if you are using the default ErrorListener, it will have written the message to the standard error output. If you're not seeing the message, then it's probably because you're running in an environment where the standard error output is being directed to some log file, or perhaps suppressed entirely. In such circumstances it's a good idea to take control of error diagnostics by setting your own ErrorListener, or by redirecting the output destination of the standard ErrorListener (which is called StandardErrorListener...) Alternatively, when you get the exception thrown back to your calling application, you will find that the exception object actually contains the information you are looking for (you're using an older release, the exception is now called net.sf.saxon.expr.XPathException, but the same applies). If you find that the exception is of the relevant class, you can examine its properties to discover the line number, etc.
Please register to reply