Mercurial > dedupe
comparison Apps/updateDeDupe.cpp @ 113:27e628852401
Add some error checking.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Tue, 03 May 2016 02:23:14 +0200 |
| parents | 5906661c0421 |
| children |
comparison
equal
deleted
inserted
replaced
| 112:3951f6d27219 | 113:27e628852401 |
|---|---|
| 1 | |
| 2 | |
| 3 #include "DataController.hpp" | 1 #include "DataController.hpp" |
| 4 | 2 |
| 5 #include "Exception/Exception.hpp" | 3 #include "Exception/Exception.hpp" |
| 6 | 4 |
| 7 #include <iostream> | 5 #include <iostream> |
| 8 #include <QtCore/QList> | 6 #include <QtCore/QList> |
| 9 #include <boost/foreach.hpp> | 7 #include <boost/foreach.hpp> |
| 10 #include <boost/archive/detail/utf8_codecvt_facet.hpp> | 8 #include <boost/archive/detail/utf8_codecvt_facet.hpp> |
| 11 #include <locale> | 9 #include <locale> |
| 10 #include <stdexcept> | |
| 12 #include <boost/archive/add_facet.hpp> | 11 #include <boost/archive/add_facet.hpp> |
| 12 | |
| 13 //#include <codecvt> | 13 //#include <codecvt> |
| 14 | 14 |
| 15 int main(int argc, char *argv[]) { | 15 int main(int argc, char *argv[]) { |
| 16 | 16 |
| 17 QStringList paths; | 17 QStringList paths; |
| 31 paths.push_back(path_buf); | 31 paths.push_back(path_buf); |
| 32 } | 32 } |
| 33 | 33 |
| 34 try { | 34 try { |
| 35 if (paths.empty()) { | 35 if (paths.empty()) { |
| 36 DataController dc(false); | 36 try { |
| 37 DataController dc(false); | |
| 38 } | |
| 39 catch (std::runtime_error &e) { | |
| 40 std::cerr << "Unrecoverable error: " << e.what() << std::endl; | |
| 41 exit(1); | |
| 42 } | |
| 37 } | 43 } |
| 38 else { | 44 else { |
| 39 foreach(const QString& path, paths) { | 45 foreach(const QString& path, paths) { |
| 40 DataController dc(path, false); | 46 DataController dc(path, false); |
| 41 } | 47 } |
