Commit c41982e0 authored by Michael Davis's avatar Michael Davis
Browse files

Fixes cta/CTA#969 `xrdfs query prepare` malformed JSON output

Refactors XrootCl.cpp to sanitise value returned by
`XrdCl::XRootDStatus::ToStr()`
parent 69f3ab27
# v4.NEXT
## Summary
### Features
### Bug fixes
- cta/CTA#969 `xrdfs query prepare` malformed JSON output
# v4.0-2
## Summary
......
......@@ -28,20 +28,18 @@
namespace cta { namespace exception {
XrootCl::XrootCl(const XrdCl::XRootDStatus& status, const std::string & what) {
std::stringstream w;
if (what.size())
w << what << " ";
w << status.ToStr() << " code:" << status.code
<< " errNo:" << status.errNo
<< " status:" << status.status;
std::string x(w.str());
x.resize(x.find_first_of('\0'));
getMessage().str(x);
if(!what.empty()) {
getMessage() << what << " ";
}
getMessage() << status.ToStr().c_str();
getMessage() << " code:" << status.code
<< " errNo:" << status.errNo
<< " status:" << status.status;
}
void XrootCl::throwOnError(const XrdCl::XRootDStatus& status, std::string context)
{
if (!status.IsOK()) {
if(!status.IsOK()) {
throw XrootCl(status, context);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment