aboutsummaryrefslogtreecommitdiff
path: root/src/function/external_text_formatter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/function/external_text_formatter.cc')
-rw-r--r--src/function/external_text_formatter.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/function/external_text_formatter.cc b/src/function/external_text_formatter.cc
index 9fef439..4171ded 100644
--- a/src/function/external_text_formatter.cc
+++ b/src/function/external_text_formatter.cc
@@ -84,10 +84,21 @@ xercesc::DOMDocument* FunctionExternalTextFormatter::constructDocument(
result.setAttribute("code", std::to_string(status.exit_status()));
if ( status.exited() ) {
- result.setAttribute("result", "success");
- result.setContent(
- importDocumentElement(outputStream, domDocument)->getChildNodes()
- );
+ try {
+ result.setContent(
+ importDocumentElement(outputStream, domDocument)->getChildNodes()
+ );
+
+ result.setAttribute("result", "success");
+ }
+ catch ( const xercesc::DOMException& exception ) {
+ result.setAttribute("result", "error");
+
+ result.setValueNode(
+ "error",
+ *XercesStringGuard<char>(exception.msg)
+ );
+ }
} else {
result.setAttribute("result", "error");
}