Skip to content

Commit

Permalink
convert all exceptions from utf8 explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
whoozle committed May 4, 2015
1 parent beb7df5 commit 09db8ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions qt/commandqueue.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "commandqueue.h"
#include "mtpobjectsmodel.h"
#include "utils.h"
#include <QFileInfo>
#include <QDebug>
#include <QApplication>
Expand All @@ -20,7 +21,7 @@ void UploadFile::execute(CommandQueue &queue)
{
queue.model()->uploadFile(fi.fileName());
} catch(const std::exception &ex)
{ qDebug() << "uploading file " << Filename << " failed: " << ex.what(); }
{ qDebug() << "uploading file " << Filename << " failed: " << fromUtf8(ex.what()); }

queue.addProgress(fi.size());
}
Expand All @@ -35,7 +36,7 @@ void DownloadFile::execute(CommandQueue &queue)
{
queue.model()->downloadFile(Filename, ObjectId);
} catch(const std::exception &ex)
{ qDebug() << "downloading file " << Filename << " failed: " << ex.what(); }
{ qDebug() << "downloading file " << Filename << " failed: " << fromUtf8(ex.what()); }

queue.addProgress(fi.size());
}
Expand Down
3 changes: 2 additions & 1 deletion qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "mainwindow.h"
#include "utils.h"
#include <QApplication>
#include <QMessageBox>

Expand All @@ -34,7 +35,7 @@ namespace
try {
return QApplication::notify( receiver, e );
} catch ( const std::exception& e ) {
QMessageBox::warning(0, "Error", e.what());
QMessageBox::warning(0, "Error", fromUtf8(e.what()));
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void MainWindow::showEvent(QShowEvent *)
}
catch(const mtp::usb::TimeoutException &ex)
{
qDebug() << "timed out getting device info: " << ex.what() << ", retrying...";
qDebug() << "timed out getting device info: " << fromUtf8(ex.what()) << ", retrying...";
if (attempt + 1 == MaxAttempts)
{
QMessageBox::critical(this, tr("MTP"), tr("MTP device does not respond"));
Expand Down
2 changes: 1 addition & 1 deletion qt/mtpobjectsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ mtp::msg::ObjectInfoPtr MtpObjectsModel::Row::GetInfo(mtp::SessionPtr session)
//qDebug() << fromUtf8(row.Info->Filename);
}
catch(const std::exception &ex)
{ qDebug() << "failed to get object info " << ex.what(); }
{ qDebug() << "failed to get object info " << fromUtf8(ex.what()); }
}
return _info;
}
Expand Down

0 comments on commit 09db8ae

Please sign in to comment.