From b0e0bc5f146c3905833b52d88ca5ec16dbf56df6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 7 May 2024 07:50:13 +0200 Subject: [PATCH] Add more details to error messages during parsing of input files --- .../ProjectDataModel/RiaOpmParserTools.cpp | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp b/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp index 9d7c7a815b..a3e9ae0476 100644 --- a/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RiaOpmParserTools.cpp @@ -25,6 +25,7 @@ #include "cafPdmUiItem.h" #include "cafUtils.h" +#include "opm/common/utility/OpmInputError.hpp" #include "opm/input/eclipse/Deck/Deck.hpp" #include "opm/input/eclipse/Parser/ParseContext.hpp" #include "opm/input/eclipse/Parser/Parser.hpp" @@ -109,8 +110,20 @@ std::vector extractVfpInjectionTables( const std::string& file tables.push_back( table ); } } + catch ( Opm::OpmInputError& e ) + { + QString text = QString( "Error detected when parsing '%1'. Imported data might be missing or incomplete.\n%2" ) + .arg( QString::fromStdString( filename ) ) + .arg( QString::fromStdString( e.what() ) ); + + RiaLogging::warning( text ); + } catch ( ... ) { + QString text = + QString( "Error detected when parsing '%1'. Imported data might be missing or incomplete." ).arg( QString::fromStdString( filename ) ); + + RiaLogging::warning( text ); } return tables; @@ -140,8 +153,20 @@ std::vector extractVfpProductionTables( const std::string& fi tables.push_back( table ); } } + catch ( Opm::OpmInputError& e ) + { + QString text = QString( "Error detected when parsing '%1'. Imported data might be missing or incomplete.\n%2" ) + .arg( QString::fromStdString( filename ) ) + .arg( QString::fromStdString( e.what() ) ); + + RiaLogging::warning( text ); + } catch ( ... ) { + QString text = + QString( "Error detected when parsing '%1'. Imported data might be missing or incomplete." ).arg( QString::fromStdString( filename ) ); + + RiaLogging::warning( text ); } return tables; @@ -194,6 +219,14 @@ std::pair, std::vector> extract } } } + catch ( Opm::OpmInputError& e ) + { + QString text = QString( "Error detected when parsing '%1'. Imported data might be missing or incomplete.\n%2" ) + .arg( QString::fromStdString( dataDeckFilename ) ) + .arg( QString::fromStdString( e.what() ) ); + + RiaLogging::warning( text ); + } catch ( ... ) { QString text = QString( "Error detected when parsing '%1'. Imported data might be missing or incomplete." )