HDF : Create ESmry reader in try catch block

This commit is contained in:
Magne Sjaastad 2021-04-13 13:04:00 +02:00
parent 7f35fb23c4
commit 30687e18bc

View File

@ -18,6 +18,8 @@
#include "RifHdf5SummaryExporter.h"
#include "RiaLogging.h"
#include "RifHdf5Exporter.h"
#include "RifSummaryReaderInterface.h"
@ -38,6 +40,8 @@ bool RifHdf5SummaryExporter::ensureHdf5FileIsCreated( const std::string& smspecF
// TODO: Use time stamp of file to make sure the smspec file is older than the h5 file
if ( !QFile::exists( QString::fromStdString( h5FileName ) ) )
{
try
{
Opm::EclIO::ESmry sourceSummaryData( smspecFileName );
@ -50,6 +54,16 @@ bool RifHdf5SummaryExporter::ensureHdf5FileIsCreated( const std::string& smspecF
writeGeneralSection( exporter, sourceSummaryData );
writeSummaryVectors( exporter, sourceSummaryData );
}
catch ( std::exception& e )
{
QString txt =
QString( "HDF export to file %1 failed : %3" ).arg( QString::fromStdString( smspecFileName ), e.what() );
RiaLogging::error( txt );
return false;
}
}
return true;
}