From eb544bcfc08e339aa35229613fe380b4f0ad30ad Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 5 Oct 2024 01:45:29 -0400 Subject: [PATCH] extractor: add error code messages around `3990` (#3699) Also added a new error code to make invalid folder paths hopefully more clear/obvious. --- .github/scripts/releases/error-code-metadata.json | 6 ++++++ decompiler/extractor/extractor_util.h | 1 + decompiler/extractor/main.cpp | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/scripts/releases/error-code-metadata.json b/.github/scripts/releases/error-code-metadata.json index 95a0cf1f8c..54a9435ea5 100644 --- a/.github/scripts/releases/error-code-metadata.json +++ b/.github/scripts/releases/error-code-metadata.json @@ -1,4 +1,10 @@ { + "3990": { + "msg": "Provided invalid or missing arguments" + }, + "3991": { + "msg": "Input path(s) do not exist" + }, "4000": { "msg": "Validation Failed: Cannot locate ELF" }, diff --git a/decompiler/extractor/extractor_util.h b/decompiler/extractor/extractor_util.h index 87cbdc83c2..9f96edd437 100644 --- a/decompiler/extractor/extractor_util.h +++ b/decompiler/extractor/extractor_util.h @@ -12,6 +12,7 @@ enum class ExtractorErrorCode { SUCCESS = 0, INVALID_CLI_INPUT = 3990, + INVALID_CLI_INPUT_MISSING_FOLDER = 3991, VALIDATION_CANT_LOCATE_ELF = 4000, VALIDATION_SERIAL_MISSING_FROM_DB = 4001, VALIDATION_ELF_MISSING_FROM_DB = 4002, diff --git a/decompiler/extractor/main.cpp b/decompiler/extractor/main.cpp index 241a6cc0f5..b969556caa 100644 --- a/decompiler/extractor/main.cpp +++ b/decompiler/extractor/main.cpp @@ -225,7 +225,7 @@ int main(int argc, char** argv) { if (!project_path_override.empty()) { if (!fs::exists(project_path_override)) { lg::error("Error: project path override '{}' does not exist", project_path_override.string()); - return static_cast(ExtractorErrorCode::INVALID_CLI_INPUT); + return static_cast(ExtractorErrorCode::INVALID_CLI_INPUT_MISSING_FOLDER); } auto ok = file_util::setup_project_path(project_path_override); if (!ok) { @@ -255,7 +255,7 @@ int main(int argc, char** argv) { // - INPUT VALIDATION if (!fs::exists(input_file_path)) { lg::error("Error: input game file path '{}' does not exist", input_file_path.string()); - return static_cast(ExtractorErrorCode::INVALID_CLI_INPUT); + return static_cast(ExtractorErrorCode::INVALID_CLI_INPUT_MISSING_FOLDER); } if (data_subfolders.count(game_name) == 0) { lg::error("Error: input game name '{}' is not valid", game_name); @@ -325,7 +325,7 @@ int main(int argc, char** argv) { } else if (fs::is_directory(input_file_path)) { if (!flag_folder) { // if we didn't request a folder explicitly, but we got one, assume something went wrong. - lg::error("got a folder, but didn't get folder flag"); + lg::error("got a folder, but didn't provide the folder flag"); return static_cast(ExtractorErrorCode::INVALID_CLI_INPUT); } iso_data_path = input_file_path;