Project

Profile

Help

Bug #4189

closed

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

Added by O'Neil Delpratt about 5 years ago. Updated over 4 years ago.

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

100%

Estimated time:
Found in version:
1.1.2
Fixed in version:
1.2.1
Platforms:

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.

Actions #1

Updated by O'Neil Delpratt about 5 years 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.

Actions #2

Updated by Michael Kay about 5 years 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.

Actions #3

Updated by O'Neil Delpratt over 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

I have changed the error message to the following pattern:

Error: No stylesheet found. Please compile stylesheet before calling applyTemplatesReturningValue or check exceptions
Actions #4

Updated by O'Neil Delpratt over 4 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 1.2.1

Bug fix applied in the Saxon/C maintenance release 1.2.1

Please register to edit this issue

Also available in: Atom PDF