Skip to content

Commit

Permalink
fix: do not catch and rethrow the same exception, which is bad for th…
Browse files Browse the repository at this point in the history
…e emitted stack trace
  • Loading branch information
Taepper committed May 31, 2024
1 parent 17a661e commit 1c49518
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions src/silo_api/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "silo/config/util/abstract_config_source.h"
#include "silo/config/util/config_repository.h"
#include "silo/config/util/yaml_file.h"
#include "silo/preprocessing/preprocessing_exception.h"
#include "silo/preprocessing/preprocessor.h"
#include "silo/preprocessing/sql_function.h"
#include "silo/storage/reference_genomes.h"
Expand Down Expand Up @@ -270,27 +271,12 @@ class SiloServer : public Poco::Util::ServerApplication {

int handlePreprocessing() {
SPDLOG_INFO("Starting SILO preprocessing");
try {
const auto preprocessing_config = preprocessingConfig(config());

auto database = runPreprocessor(preprocessing_config);

database.saveDatabaseState(preprocessing_config.getOutputDirectory());
} catch (const std::exception& ex) {
SPDLOG_ERROR(ex.what());
throw ex;
} catch (const std::string& ex) {
SPDLOG_ERROR(ex);
return 1;
} catch (...) {
SPDLOG_ERROR("Preprocessing cancelled with uncatchable (...) exception");
const auto exception = std::current_exception();
if (exception) {
const auto* message = abi::__cxa_current_exception_type()->name();
SPDLOG_ERROR("current_exception: {}", message);
}
return 1;
}
const auto preprocessing_config = preprocessingConfig(config());

auto database = runPreprocessor(preprocessing_config);

database.saveDatabaseState(preprocessing_config.getOutputDirectory());

return Application::EXIT_OK;
}

Expand Down

0 comments on commit 1c49518

Please sign in to comment.