Changeset 9782bbb for src/sql/schedulexmlparser.cpp
- Timestamp:
- 09/27/17 22:36:57 (5 years ago)
- Branches:
- master
- Children:
- 01d1452
- Parents:
- 961971e
- git-author:
- Philipp Spitzer <philipp@…> (09/27/17 22:20:05)
- git-committer:
- Philipp Spitzer <philipp@…> (09/27/17 22:36:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sql/schedulexmlparser.cpp
r961971e r9782bbb 33 33 34 34 35 class ParseException: public std::runtime_error { 36 public: 37 ParseException(const QString& message): std::runtime_error(message.toStdString()) {} 38 }; 39 40 35 41 void ScheduleXmlParser::parseDataImpl(const QByteArray &aData, const QString& url, int conferenceId) { 36 42 QDomDocument document; … … 38 44 int xml_error_line; 39 45 int xml_error_column; 40 if (!document.setContent (aData, false, &xml_error, &xml_error_line, &xml_error_column)) { 41 error_message("Could not parse schedule: " + xml_error + " at line " + QString("%1").arg(xml_error_line) + " column " + QString("%1").arg(xml_error_column)); 42 return; 46 if (!document.setContent(aData, false, &xml_error, &xml_error_line, &xml_error_column)) { 47 throw ParseException("Could not parse schedule: " + xml_error + " at line " + QString("%1").arg(xml_error_line) + " column " + QString("%1").arg(xml_error_column)); 43 48 } 44 49 … … 166 171 } // parsing day elements 167 172 } // schedule element 168 if (!conference_title.isNull()) { 169 transaction.commit(); 170 emit parsingScheduleEnd(conferenceId); 171 } else { 172 error_message("Could not parse schedule"); 173 } 173 if (conference_title.isNull()) throw ParseException("Could not parse schedule"); 174 175 transaction.commit(); 176 emit parsingScheduleEnd(conferenceId); 174 177 } 175 178 176 179 177 180 void ScheduleXmlParser::parseData(const QByteArray &aData, const QString& url, int conferenceId) { 178 parseDataImpl(aData, url, conferenceId); 181 try { 182 parseDataImpl(aData, url, conferenceId); 183 } catch (ParseException& e) { 184 error_message(e.what()); 185 } 179 186 } 180 187
Note: See TracChangeset
for help on using the changeset viewer.