Skip to content

Commit

Permalink
Use HTTPStatus enum types and not strings. Refs #8727.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Feb 3, 2014
1 parent 912c7c1 commit 448a32c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -16,7 +16,7 @@ namespace Mantid
/// Create a catalog to use in the algorithms.
API::ICatalog_sptr createCatalog();
/// Obtain the error message returned by the IDS.
const std::string getIDSError(const std::string &HTTPStatus, std::istream& responseStream);
const std::string getIDSError(Poco::Net::HTTPResponse::HTTPStatus &HTTPStatus, std::istream& responseStream);
};
}
}
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/Framework/ICat/src/CatalogAlgorithmHelper.cpp
Expand Up @@ -2,6 +2,7 @@

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/assign/list_of.hpp>

namespace Mantid
{
Expand Down Expand Up @@ -33,11 +34,12 @@ namespace Mantid
* @param responseStream :: The contents of the stream (a JSON stream) returned from the IDS.
* @returns An appropriate error message for the user if it exists. Otherwise an empty string.
*/
const std::string CatalogAlgorithmHelper::getIDSError(const std::string &HTTPStatus, std::istream& responseStream)
const std::string CatalogAlgorithmHelper::getIDSError(Poco::Net::HTTPResponse::HTTPStatus &HTTPStatus, std::istream& responseStream)
{
// Set containing all valid HTTPStatus'.
std::string tmp[] = {"200", "201", "202"};
std::set<std::string> successHTTPStatus(tmp, tmp + sizeof(tmp) / sizeof(tmp[0]));
std::set<Poco::Net::HTTPResponse::HTTPStatus> successHTTPStatus = boost::assign::list_of
(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK)
(Poco::Net::HTTPResponse::HTTPStatus::HTTP_CREATED)
(Poco::Net::HTTPResponse::HTTPStatus::HTTP_ACCEPTED);

// Cancel the algorithm and output message if status returned
// from the server is not in our successHTTPStatus set.
Expand Down

0 comments on commit 448a32c

Please sign in to comment.