diff --git a/project.godot b/project.godot index 225ff045304..62c02433798 100644 --- a/project.godot +++ b/project.godot @@ -42,7 +42,6 @@ Export="*res://src/Autoload/Export.gd" Palettes="*res://src/Autoload/Palettes.gd" Keychain="*res://addons/keychain/Keychain.gd" ExtensionsApi="*res://src/Autoload/ExtensionsAPI.gd" -ErrorManager="*res://src/Autoload/ErrorManager.gd" [debug] diff --git a/src/Autoload/ErrorManager.gd b/src/Autoload/ErrorManager.gd deleted file mode 100644 index 619440bf85e..00000000000 --- a/src/Autoload/ErrorManager.gd +++ /dev/null @@ -1,108 +0,0 @@ -extends Node - - -func parse(error: int, start := "", end := ""): - var message: String - match error: - OK: - message = "everything is fine" - FAILED: - message = "Generic error." - ERR_UNAVAILABLE: - message = "Unavailable error." - ERR_UNCONFIGURED: - message = "Unconfigured error." - ERR_UNAUTHORIZED: - message = "Unauthorized error." - ERR_PARAMETER_RANGE_ERROR: - message = "Parameter range error." - ERR_OUT_OF_MEMORY: - message = "Out of memory (OOM) error." - ERR_FILE_NOT_FOUND: - message = "File: Not found error." - ERR_FILE_BAD_DRIVE: - message = "File: Bad drive error." - ERR_FILE_BAD_PATH: - message = "File: Bad path error." - ERR_FILE_NO_PERMISSION: - message = "File: No permission error." - ERR_FILE_ALREADY_IN_USE: - message = "File: Already in use error." - ERR_FILE_CANT_OPEN: - message = "File: Can't open error." - ERR_FILE_CANT_WRITE: - message = "File: Can't write error." - ERR_FILE_CANT_READ: - message = "File: Can't read error." - ERR_FILE_UNRECOGNIZED: - message = "File: Unrecognized error." - ERR_FILE_CORRUPT: - message = "File: Corrupt error." - ERR_FILE_MISSING_DEPENDENCIES: - message = "File: Missing dependencies error." - ERR_FILE_EOF: - message = "File: End of file (EOF) error." - ERR_CANT_OPEN: - message = "Can't open error." - ERR_CANT_CREATE: - message = "Can't create error." - ERR_QUERY_FAILED: - message = "Query failed error." - ERR_ALREADY_IN_USE: - message = "Already in use error." - ERR_LOCKED: - message = "Locked error." - ERR_TIMEOUT: - message = "Timeout error." - ERR_CANT_CONNECT: - message = "Can't connect error." - ERR_CANT_RESOLVE: - message = "Can't resolve error." - ERR_CONNECTION_ERROR: - message = "Connection error." - ERR_CANT_ACQUIRE_RESOURCE: - message = "Can't acquire resource error." - ERR_CANT_FORK: - message = "Can't fork process error." - ERR_INVALID_DATA: - message = "Invalid data error." - ERR_INVALID_PARAMETER: - message = "Invalid parameter error." - ERR_ALREADY_EXISTS: - message = "Already exists error." - ERR_DOES_NOT_EXIST: - message = "Does not exist error." - ERR_DATABASE_CANT_READ: - message = "Database: Read error." - ERR_DATABASE_CANT_WRITE: - message = "Database: Write error." - ERR_COMPILATION_FAILED: - message = "Compilation failed error." - ERR_METHOD_NOT_FOUND: - message = "Method not found error." - ERR_LINK_FAILED: - message = "Linking failed error." - ERR_SCRIPT_FAILED: - message = "Script failed error." - ERR_CYCLIC_LINK: - message = "Cycling link (import cycle) error." - ERR_INVALID_DECLARATION: - message = "Invalid declaration error." - ERR_DUPLICATE_SYMBOL: - message = "Duplicate symbol error." - ERR_PARSE_ERROR: - message = "Parse error." - ERR_BUSY: - message = "Busy error." - ERR_SKIP: - message = "Skip error." - ERR_HELP: - message = "Help error." - ERR_BUG: - message = "Bug error." - ERR_PRINTER_ON_FIRE: -# gdlint: ignore=max-line-length - message = "Printer on fire error. (This is an easter egg, no engine methods return this error code.)" - _: - message = "Unknown error" - return str(start, message, end) diff --git a/src/Autoload/Export.gd b/src/Autoload/Export.gd index 35c2fe621df..68973465f40 100644 --- a/src/Autoload/Export.gd +++ b/src/Autoload/Export.gd @@ -262,10 +262,7 @@ func export_processed_images( var err := processed_images[i].save_png(export_paths[i]) if err != OK: Global.error_dialog.set_text( - ( - tr("File failed to save. Error code %s") - % str(err, ErrorManager.parse(err, " (", ")")) - ) + tr("File failed to save. Error code %s (%s)") % [err, error_string(err)] ) Global.error_dialog.popup_centered() Global.dialog_open(true) diff --git a/src/Autoload/OpenSave.gd b/src/Autoload/OpenSave.gd index 7d9b3c9b3b6..97fe615bc9a 100644 --- a/src/Autoload/OpenSave.gd +++ b/src/Autoload/OpenSave.gd @@ -118,11 +118,10 @@ func open_pxo_file(path: String, untitled_backup: bool = false, replace_empty: b var err := FileAccess.get_open_error() if err != OK: Global.error_dialog.set_text( - tr("File failed to open. Error code %s") % str(err, ErrorManager.parse(err, " (", ")")) + tr("File failed to open. Error code %s (%s)") % [err, error_string(err)] ) Global.error_dialog.popup_centered() Global.dialog_open(true) - file.close() return var empty_project: bool = Global.current_project.is_empty() and replace_empty @@ -395,7 +394,7 @@ func save_pxo_file( if temp_path.is_valid_filename(): return Global.error_dialog.set_text( - tr("File failed to save. Error code %s") % str(err, ErrorManager.parse(err, " (", ")")) + tr("File failed to save. Error code %s (%s)") % [err, error_string(err)] ) Global.error_dialog.popup_centered() Global.dialog_open(true) diff --git a/src/Preferences/HandleExtensions.gd b/src/Preferences/HandleExtensions.gd index eed5d5689d2..58f06120f82 100644 --- a/src/Preferences/HandleExtensions.gd +++ b/src/Preferences/HandleExtensions.gd @@ -142,7 +142,7 @@ func _add_extension(file_name: String) -> void: var extension_config_file := FileAccess.open(extension_config_file_path, FileAccess.READ) var err := FileAccess.get_open_error() if err != OK: - print("Error loading config file: ", err, ErrorManager.parse(err, " (", ")")) + print("Error loading config file: ", err, " (", error_string(err), ")") extension_config_file.close() return