-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add message for generic parsing exceptions #4408
Conversation
d4a7f82
to
7e40c5a
Compare
@jelovirt - this is a nice enhancement, especially now being able to override this class of message as desired. |
<reason>%1</reason> | ||
<response></response> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we know this is an XML parsing error, should we say so?
<reason>%1</reason> | |
<response></response> | |
<reason>XML parsing error: </reason> | |
<response>%1</response> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The %1
in this case is the error message thrown by the XML parser. It describes what the error condition is, like "Attribute value "%50" of type ID must be an NCName when namespaces are enabled.".
This means it's not a response that describes what the user should do next. Because this is a generic parsing, we don't know what the next step should be. It could be "fix your specialization" or "fix your content".
This error message has been thrown before, just without any message ID. This allows us to make it easier for users to locate a description of this generic error in the message reference. There we can describe that there was something wrong with your DITA file, check that; or, if you're using a custom specialization, there may be some issue there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so we leave the placeholder in the <reason>
element, but shall we add the intro for context:
<reason>%1</reason> | |
<response></response> | |
<reason>XML parsing error: %1</reason> | |
<response></response> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to not use a prefix in the reason, but it may be useful for users 🤷🏽. I'll need to get more examples of those messages to help in deciding whether it's helpful of not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Xerces produces error messages listed at https://github.com/apache/xerces2-j/blob/trunk/src/org/apache/xerces/impl/msg/XMLMessages.properties#L230. The messages are in sentence format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added XML parsing error:
prefix to the message.
7e40c5a
to
a74d0e8
Compare
a74d0e8
to
8a66297
Compare
Signed-off-by: Jarno Elovirta <jarno@elovirta.com>
Signed-off-by: Jarno Elovirta <jarno@elovirta.com>
8a66297
to
37d8dc3
Compare
Description
When the input XML is in some way invalid but it can still be parsed, for example
the XML parser will throw an exception with message
We currently capture this and log out as an error message.
In order to give as many messages an ID as possible, we add a message ID for generic parsing errors where the
<reason>
of the message is provided by the XML parser and the<response>
is left empty. The logged message will beor for example with incorrect attribute name that goes against the DTD
Motivation and Context
Add error ID for parsing exceptions to improve debugging.
How Has This Been Tested?
Manual testing.
Type of Changes
Documentation and Compatibility
This is a generic error message, so we don't know in advance what the error message will be. Users may override the message configuration to be e.g.
if they want to add more context to the message.