-
Notifications
You must be signed in to change notification settings - Fork 81
Allow formatting of error messages as JSON #8981
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
Conversation
…orMessageFormatter
core/src/main/java/org/frankframework/errormessageformatters/ErrorMessageFormatter.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
@Protected | ||
public void setMessageFormat(@Nonnull DocumentFormat messageFormat) { |
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.
Waarom override je deze method hier en in de XslErrorMessageFormatter? Het doet precies hetzelfde als in de super.
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.
Om de @Protected
annotatie toe te voegen, die voorkomt dat de setter in de Frank!Doc komt en via Configuration gezet kan worden.
Ik had geen comment toegevoegd omdat ik dacht dat het uit de annotatie duidelijk zou moeten zijn, maar zal een kort comment toevoegen. :-)
…rrorMessageFormatter.java Co-authored-by: Erik <dongenevan@gmail.com>
assertNotNull(errorAsString); | ||
|
||
String expected = """ | ||
<errorMessage timestamp="Wed May 14 16:26:41 CEST 2025" originator="IAF " message="MyLocation [dummy-location] msgId [dummy-message-id]: dummy-error-message"> |
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.
Ik heb liever dat hier de ignores hard in staan, dan is de replace minder foutgevoelig...
@Protected | ||
public void setMessageFormat(@Nonnull DocumentFormat messageFormat) { | ||
// Add no logic, override to add @Protected annotation which will make sure this method cannot be used from configuration for this class | ||
super.setMessageFormat(messageFormat); |
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.
Eventueel kan je hier een exceptie gooien, notimplementedexception oid.
@Protected | ||
public void setMessageFormat(@Nonnull DocumentFormat messageFormat) { | ||
// Add no logic, override to add @Protected annotation which will make sure this method cannot be used from configuration for this class | ||
super.setMessageFormat(messageFormat); |
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.
Eventueel kan je hier een exceptie gooien, notimplementedexception oid.
# Conflicts: # core/src/main/java/org/frankframework/errormessageformatters/ErrorMessageFormatter.java # core/src/main/java/org/frankframework/errormessageformatters/SoapErrorMessageFormatter.java # nn-specials/src/main/java/org/frankframework/errormessageformatters/Y01ErrorMessageFormatter.java
|
Ik zie dat Sonar en Codacy een issue hebben met het gooien van RuntimeException; daar had ik al iets aan gedaan maar in mijn PR voor de DataSonnetErrorFormatter dus dat komt later goed. 😃 |
} | ||
errorObject.addAttribute("timestamp", new Date().toString()); | ||
errorObject.addAttribute("originator", originator); | ||
errorObject.addAttribute("message", XmlEncodingUtils.replaceNonValidXmlCharacters(errorMessage)); |
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.
In de SaxElementBuilder#addAttribute(String, String)
zit ook al een replace xml ding dacht ik. Misschien kan deze wel weg :)
if (t != null) { | ||
e.addSuppressed(t); | ||
} | ||
throw new RuntimeException("Cannot create formatted error message for error [" + errorMessage + "]", e); |
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.
Poeh, ik weet niet of ik runtime wel zo mooi vind...
Adding a DataSonnetErrorMessageFormatter will come in a follow-up PR, to keep the changes smaller.