Project

Profile

Help

Bug #4189

Error message does not indicate the Saxon/C method it was called from.

Added by O'Neil Delpratt 6 months ago. Updated 6 months ago.

Status:
New
Priority:
Normal
Category:
Saxon-C Internals
Start date:
2019-04-01
Due date:
% Done:

0%

Found in version:
1.1.2
Fixed in version:

Description

Reported by user:

While updating to the new Saxon/C version, I spent quite an hour trying to figure out why I got

Error on line 1 column 1 of file: SXXP0003: Error reported by XML parser: Content is not allowed in prolog. Error: The most recent Stylesheet Object failed or has not been set.

In the end, it turned out I had mixed up compileFromString with compileFromFile. So, you might want to consider changing the error message in this case to something more obvious.

History

#1 Updated by O'Neil Delpratt 6 months ago

This error message message is coming from the Saxon internals. It is unfortunate that the error message does not give more details of the method it was called from. Maybe we can make the message more user friendly by concatenating the method name.

Running the gdb (GNU Debugger) would have given the stack trace.

#2 Updated by Michael Kay 6 months ago

This kind of thing is a perennial problem: reporting the error exactly as returned by an underlying component (in this case the XML parser) loses the context of what the user was doing at the time, while reporting the error in terms of what the user was doing loses information about how and why it failed. Our general approach should be to concatenate the error messages: first report what the user was doing, then report what went wrong:

Error reported by XML parser when compiling stylesheet using compileFromString(): Error on line 1 column 1 of file: SXXP0003: Content is not allowed in Prolog.

The message "The most recent Stylesheet Object failed or has not been set." feels like it's referring to Saxon internals rather than something the user is in control of?

The part of the message saying what method was being called is redundant if a stack trace is output that contains this information.

Please register to edit this issue

Also available in: Atom PDF