mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Avoid throwing exception when opening a file for export
This commit is contained in:
parent
6ad42817c6
commit
d91e8ccb56
@ -883,15 +883,15 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
|||||||
|
|
||||||
if ( !completionsForMainGrid.empty() )
|
if ( !completionsForMainGrid.empty() )
|
||||||
{
|
{
|
||||||
try
|
QFileInfo fi( fileName );
|
||||||
{
|
std::shared_ptr<QFile> exportFile =
|
||||||
QFileInfo fi( fileName );
|
RicWellPathExportCompletionsFileTools::openFileForExport( folderName,
|
||||||
std::shared_ptr<QFile> exportFile =
|
fi.baseName(),
|
||||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName,
|
fi.suffix(),
|
||||||
fi.baseName(),
|
exportDataSourceAsComment );
|
||||||
fi.suffix(),
|
|
||||||
exportDataSourceAsComment );
|
|
||||||
|
|
||||||
|
if ( exportFile )
|
||||||
|
{
|
||||||
std::map<QString, std::vector<RigCompletionData>> completionsForGrid;
|
std::map<QString, std::vector<RigCompletionData>> completionsForGrid;
|
||||||
completionsForGrid.insert( std::pair<QString, std::vector<RigCompletionData>>( "", completionsForMainGrid ) );
|
completionsForGrid.insert( std::pair<QString, std::vector<RigCompletionData>>( "", completionsForMainGrid ) );
|
||||||
|
|
||||||
@ -902,24 +902,21 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
|||||||
}
|
}
|
||||||
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForGrid, exportType, exportDataSourceAsComment );
|
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForGrid, exportType, exportDataSourceAsComment );
|
||||||
}
|
}
|
||||||
catch ( RicWellPathExportCompletionsFileTools::OpenFileException )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !completionsForSubGrids.empty() )
|
if ( !completionsForSubGrids.empty() )
|
||||||
{
|
{
|
||||||
try
|
QFileInfo fi( fileName );
|
||||||
|
|
||||||
|
QString lgrFileName = fi.baseName() + "_LGR";
|
||||||
|
std::shared_ptr<QFile> exportFile =
|
||||||
|
RicWellPathExportCompletionsFileTools::openFileForExport( folderName,
|
||||||
|
lgrFileName,
|
||||||
|
fi.suffix(),
|
||||||
|
exportDataSourceAsComment );
|
||||||
|
|
||||||
|
if ( exportFile )
|
||||||
{
|
{
|
||||||
QFileInfo fi( fileName );
|
|
||||||
|
|
||||||
QString lgrFileName = fi.baseName() + "_LGR";
|
|
||||||
std::shared_ptr<QFile> exportFile =
|
|
||||||
RicWellPathExportCompletionsFileTools::openFileForExport( folderName,
|
|
||||||
lgrFileName,
|
|
||||||
fi.suffix(),
|
|
||||||
exportDataSourceAsComment );
|
|
||||||
|
|
||||||
exportWellPathFractureReport( eclipseCase, exportFile, wellPathFractureReportItems );
|
exportWellPathFractureReport( eclipseCase, exportFile, wellPathFractureReportItems );
|
||||||
if ( exportWelspec )
|
if ( exportWelspec )
|
||||||
{
|
{
|
||||||
@ -927,9 +924,6 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile(
|
|||||||
}
|
}
|
||||||
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForSubGrids, exportType, exportDataSourceAsComment );
|
exportCompdatAndWpimultTables( eclipseCase, exportFile, completionsForSubGrids, exportType, exportDataSourceAsComment );
|
||||||
}
|
}
|
||||||
catch ( RicWellPathExportCompletionsFileTools::OpenFileException )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,14 +33,6 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RicWellPathExportCompletionsFileTools::OpenFileException::OpenFileException( const QString& message )
|
|
||||||
: message( message )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -60,7 +52,7 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFile( const QS
|
|||||||
{
|
{
|
||||||
auto errorMessage = QString( "Selected output folder does not exist, and could not be created." );
|
auto errorMessage = QString( "Selected output folder does not exist, and could not be created." );
|
||||||
RiaLogging::error( errorMessage );
|
RiaLogging::error( errorMessage );
|
||||||
throw OpenFileException( errorMessage );
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +63,7 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFile( const QS
|
|||||||
{
|
{
|
||||||
auto errorMessage = QString( "Export Completions Data: Could not open the file: %1" ).arg( filePath );
|
auto errorMessage = QString( "Export Completions Data: Could not open the file: %1" ).arg( filePath );
|
||||||
RiaLogging::error( errorMessage );
|
RiaLogging::error( errorMessage );
|
||||||
throw OpenFileException( errorMessage );
|
return nullptr;
|
||||||
}
|
}
|
||||||
return exportFile;
|
return exportFile;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,6 @@ class RimWellPath;
|
|||||||
class RicWellPathExportCompletionsFileTools
|
class RicWellPathExportCompletionsFileTools
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class OpenFileException
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
OpenFileException( const QString& message );
|
|
||||||
QString message;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const RimWellPath* findWellPathFromExportName( const QString& wellNameForExport );
|
static const RimWellPath* findWellPathFromExportName( const QString& wellNameForExport );
|
||||||
|
|
||||||
static std::shared_ptr<QFile>
|
static std::shared_ptr<QFile>
|
||||||
|
Loading…
Reference in New Issue
Block a user