Skip to content

Commit

Permalink
extractor: add error code messages around 3990 (#3699)
Browse files Browse the repository at this point in the history
Also added a new error code to make invalid folder paths hopefully more
clear/obvious.
  • Loading branch information
xTVaser authored Oct 5, 2024
1 parent cb4f777 commit eb544bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/scripts/releases/error-code-metadata.json
Original file line number Diff line number Diff line change
@@ -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"
},
Expand Down
1 change: 1 addition & 0 deletions decompiler/extractor/extractor_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions decompiler/extractor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(ExtractorErrorCode::INVALID_CLI_INPUT);
return static_cast<int>(ExtractorErrorCode::INVALID_CLI_INPUT_MISSING_FOLDER);
}
auto ok = file_util::setup_project_path(project_path_override);
if (!ok) {
Expand Down Expand Up @@ -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<int>(ExtractorErrorCode::INVALID_CLI_INPUT);
return static_cast<int>(ExtractorErrorCode::INVALID_CLI_INPUT_MISSING_FOLDER);
}
if (data_subfolders.count(game_name) == 0) {
lg::error("Error: input game name '{}' is not valid", game_name);
Expand Down Expand Up @@ -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<int>(ExtractorErrorCode::INVALID_CLI_INPUT);
}
iso_data_path = input_file_path;
Expand Down

0 comments on commit eb544bc

Please sign in to comment.