Skip to content

Commit

Permalink
Obtain specific error message from soap method instead. Refs #8538.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Apr 25, 2014
1 parent c1c6557 commit 4f19b94
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Expand Up @@ -946,25 +946,10 @@ namespace Mantid
template<class T>
void ICat4Catalog::throwSoapError(T& soapProxy)
{
char buf[600];
const int len = 600;
soapProxy.soap_sprint_fault(buf,len);
std::string error(buf);
std::string begmsg("<message>");
std::string endmsg("</message>");

std::basic_string <char>::size_type start = error.find(begmsg);
std::basic_string <char>::size_type end = error.find(endmsg);
std::string exception;

if(start != std::string::npos && end != std::string::npos)
{
exception = error.substr(start + begmsg.length(), end - (start + begmsg.length()) );
}
std::string error = soapProxy.soap_fault_string();
// If no error is returned by ICAT then there is a connection problem.
if (exception.empty()) exception = "ICAT appears to be offline. Please check your connection or report this issue.";

throw std::runtime_error(exception);
if (error.empty()) error = "ICAT appears to be offline. Please check your connection or report this issue.";
throw std::runtime_error(error);
}

/**
Expand Down

0 comments on commit 4f19b94

Please sign in to comment.