From fd70b086ef9e609bea92acf643cca36eef6e5cce Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Thu, 24 May 2018 22:06:13 +0200 Subject: [PATCH] more check writing tandem presets --- src/files/tandemparametersfile.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/files/tandemparametersfile.cpp b/src/files/tandemparametersfile.cpp index bf0711d9e..bd98d3f5b 100644 --- a/src/files/tandemparametersfile.cpp +++ b/src/files/tandemparametersfile.cpp @@ -76,6 +76,7 @@ void TandemParametersFile::setTandemParameters(const TandemParameters & paramete QFile xml_file(_param_source.absoluteFilePath()); QFile new_file(QString("%1/%2.xml").arg(_param_source.absolutePath()).arg(parameters.getMethodName())); + try { if (_param_source.absoluteFilePath() != QFileInfo( new_file).absoluteFilePath()) { if (xml_file.exists()) { //move if renamed @@ -95,6 +96,14 @@ void TandemParametersFile::setTandemParameters(const TandemParameters & paramete { throw pappso::PappsoException(QObject::tr("error : cannot open the XML X!Tandem parameter file : %1\n").arg(new_file.fileName())); } + } + + catch (pappso::PappsoException & error_pappso) { + throw pappso::PappsoException(QObject::tr("error writing tandem preset file %1 : \n%2").arg(QFileInfo( new_file).absoluteFilePath()).arg(error_pappso.qwhat())); + } + catch (std::exception & error) { + throw pappso::PappsoException(QObject::tr("error writing tandem preset file %1 : \n%2").arg(QFileInfo( new_file).absoluteFilePath()).arg(error.what())); + } } -- GitLab