diff --git a/backends/twitter/TwitterResponseParser.cpp b/backends/twitter/TwitterResponseParser.cpp index 350f25c8453cb5cadc92d850dda6c40c237a0c9c..c2d2eec340086768741abb7de3c7860f276f5ec7 100644 --- a/backends/twitter/TwitterResponseParser.cpp +++ b/backends/twitter/TwitterResponseParser.cpp @@ -98,3 +98,15 @@ std::vector getIDs(std::string &xml) } return IDs; } + +std::string getErrorMessage(std::string &xml) +{ + std::string error; + Swift::ParserElement::ref rootElement = Swift::StringTreeParser::parse(xml); + + const std::string xmlns = rootElement->getNamespace(); + const Swift::ParserElement::ref errorElement = rootElement->getChild(TwitterReponseTypes::error, xmlns); + + if(errorElement != NULL) error = errorElement->getText(); + return error; +}