From c5da22223b9fa2525d9657a728905970e943fa0e Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 10 Jun 2024 13:23:13 +0200 Subject: [PATCH] Osdu wellpath import: improve error handling. --- .../OsduImportCommands/RiaOsduConnector.cpp | 4 +++- .../RicWellPathsImportOsduFeature.cpp | 16 ++++++++-------- .../Commands/RicImportWellLogOsduFeature.cpp | 15 +++++++-------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RiaOsduConnector.cpp b/ApplicationLibCode/Commands/OsduImportCommands/RiaOsduConnector.cpp index faade6fec1..1722469a37 100644 --- a/ApplicationLibCode/Commands/OsduImportCommands/RiaOsduConnector.cpp +++ b/ApplicationLibCode/Commands/OsduImportCommands/RiaOsduConnector.cpp @@ -677,7 +677,9 @@ void RiaOsduConnector::requestParquetData( const QString& url, const QString& da } else { - RiaLogging::error( "Download failed: " + url + " failed." + reply->errorString() ); + QString errorMessage = "Download failed: " + url + " failed." + reply->errorString(); + RiaLogging::error( errorMessage ); + emit parquetDownloadFinished( QByteArray(), errorMessage ); } } ); } diff --git a/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp b/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp index 7da62c2454..8b4cbbf1ce 100644 --- a/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp +++ b/ApplicationLibCode/Commands/OsduImportCommands/RicWellPathsImportOsduFeature.cpp @@ -83,18 +83,18 @@ void RicWellPathsImportOsduFeature::onActionTriggered( bool isChecked ) std::vector importedWells = wellImportwizard.importedWells(); for ( auto w : importedWells ) { - auto wellPath = new RimOsduWellPath; - wellPath->setName( w.name ); - wellPath->setWellId( w.wellId ); - wellPath->setWellboreId( w.wellboreId ); - wellPath->setWellboreTrajectoryId( w.wellboreTrajectoryId ); - - oilField->wellPathCollection->addWellPath( wellPath ); - auto [wellPathGeometry, errorMessage] = RimWellPathCollection::loadWellPathGeometryFromOsdu( osduConnector, w.wellboreTrajectoryId ); if ( wellPathGeometry.notNull() ) { + auto wellPath = new RimOsduWellPath; + wellPath->setName( w.name ); + wellPath->setWellId( w.wellId ); + wellPath->setWellboreId( w.wellboreId ); + wellPath->setWellboreTrajectoryId( w.wellboreTrajectoryId ); + + oilField->wellPathCollection->addWellPath( wellPath ); + wellPath->setWellPathGeometry( wellPathGeometry.p() ); } else diff --git a/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp b/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp index 38c484c127..9f34260a49 100644 --- a/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportWellLogOsduFeature.cpp @@ -66,22 +66,21 @@ void RicImportWellLogOsduFeature::onActionTriggered( bool isChecked ) for ( OsduWellLog wellLog : wellLogs ) { - RimOsduWellLog* osduWellLog = new RimOsduWellLog; - osduWellLog->setName( wellLog.id ); - osduWellLog->setWellLogId( wellLog.id ); - oilField->wellPathCollection->addWellLog( osduWellLog, wellPath ); - - auto [wellLogData, errorMessage] = RimWellPathCollection::loadWellLogFromOsdu( osduConnector, osduWellLog->wellLogId() ); + auto [wellLogData, errorMessage] = RimWellPathCollection::loadWellLogFromOsdu( osduConnector, wellLog.id ); if ( wellLogData.notNull() ) { + RimOsduWellLog* osduWellLog = new RimOsduWellLog; + osduWellLog->setName( wellLog.id ); + osduWellLog->setWellLogId( wellLog.id ); + oilField->wellPathCollection->addWellLog( osduWellLog, wellPath ); + osduWellLog->setWellLogData( wellLogData.p() ); + osduWellLog->updateConnectedEditors(); } else { RiaLogging::error( "Importing OSDU well log failed: " + errorMessage ); } - - osduWellLog->updateConnectedEditors(); } } }