Skip to content

Commit

Permalink
unit_json_factory.cpp: catch std::exception instead of boost::json::s…
Browse files Browse the repository at this point in the history
…ystem_error
  • Loading branch information
stephengtuggy committed Jan 14, 2025
1 parent 82b09eb commit 3781301
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions engine/src/cmd/unit_json_factory.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
* unit_csv_factory.cpp
*
* Copyright (C) 2021 Roy Falk
* Copyright (C) 2022 Stephen G. Tuggy
* Copyright (C) 2021-2025 Roy Falk and Stephen G. Tuggy
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
*
Expand Down Expand Up @@ -42,8 +41,8 @@ void UnitJSONFactory::ParseJSON(VSFileSystem::VSFile &file, bool player_ship) {
boost::json::value json_value;
try {
json_value = boost::json::parse(json_text);
} catch (boost::json::system_error& e) {
VS_LOG_FLUSH_EXIT(fatal, "Error parsing JSON in UnitJSONFactory::ParseJSON()", e.code().value());
} catch (std::exception const& e) {
VS_LOG_FLUSH_EXIT(fatal, (boost::format("Error parsing JSON in UnitJSONFactory::ParseJSON(): %1%") % e.what()), 42);
}
boost::json::array root_array = json_value.get_array();

Expand Down

0 comments on commit 3781301

Please sign in to comment.