add error_string to error codes
This commit is contained in:
parent
a0428d90d6
commit
728cc4452d
@ -71,12 +71,8 @@ func _load_config() -> Error:
|
||||
print("\nloading layout config....")
|
||||
var err := _config.load(CONFIG_PATH)
|
||||
|
||||
if err == ERR_FILE_NOT_FOUND:
|
||||
print("layout config file not found\n")
|
||||
return FAILED
|
||||
|
||||
if err != OK:
|
||||
push_error("failed to load layout config file: '%s'" % err)
|
||||
push_error("failed to load layout config file: '%s'" % error_string(err))
|
||||
print()
|
||||
return FAILED
|
||||
|
||||
@ -126,7 +122,7 @@ func _save_config() -> Error:
|
||||
var err := _config.save(CONFIG_PATH)
|
||||
|
||||
if err != OK:
|
||||
push_error("failed to save config file: '%s'" % err)
|
||||
push_error("failed to save config file: '%s'" % error_string(err))
|
||||
return err
|
||||
|
||||
return OK
|
||||
@ -136,22 +132,26 @@ func _load_custom_layouts(path: String) -> void:
|
||||
if not DirAccess.dir_exists_absolute(path):
|
||||
var dir_err := DirAccess.make_dir_absolute(path)
|
||||
if dir_err != OK:
|
||||
push_error("error creating directory '%s': %s" % [path, dir_err])
|
||||
push_error(
|
||||
"error creating directory '%s': %s" % [path, error_string(dir_err)]
|
||||
)
|
||||
print()
|
||||
return
|
||||
var file_err := DirAccess.copy_absolute(
|
||||
CUSTOM_LAYOUTS_README, path.path_join(CUSTOM_LAYOUTS_README.get_file())
|
||||
)
|
||||
if file_err != OK:
|
||||
push_error("error copying file '%s': %s" % [CUSTOM_LAYOUTS_README, file_err])
|
||||
push_error(
|
||||
(
|
||||
"error copying file '%s': %s"
|
||||
% [CUSTOM_LAYOUTS_README, error_string(file_err)]
|
||||
)
|
||||
)
|
||||
|
||||
var dir := DirAccess.open(path)
|
||||
if not dir:
|
||||
var err := DirAccess.get_open_error()
|
||||
if err == ERR_FILE_NOT_FOUND:
|
||||
push_error("directory not found '%s'" % path)
|
||||
else:
|
||||
push_error("error opening directory '%s': %s" % [path, err])
|
||||
push_error("error opening directory '%s': %s" % [path, error_string(err)])
|
||||
print()
|
||||
return
|
||||
|
||||
|
||||
@ -43,10 +43,7 @@ func _load_json_file(path: String) -> Variant:
|
||||
var file := FileAccess.open(path, FileAccess.READ)
|
||||
if not file:
|
||||
var file_err := FileAccess.get_open_error()
|
||||
if file_err == ERR_FILE_NOT_FOUND:
|
||||
push_error("%s: file not found" % _file_name)
|
||||
else:
|
||||
push_error("%s: error opening file: %s" % [_file_name, file_err])
|
||||
push_error("%s: error opening file: %s" % [_file_name, error_string(file_err)])
|
||||
return []
|
||||
|
||||
var content := file.get_as_text()
|
||||
|
||||
@ -321,12 +321,9 @@ func _get_keymap_keys(data_keys: Array, json_file_name: String) -> Error:
|
||||
)
|
||||
if not file:
|
||||
var file_err := FileAccess.get_open_error()
|
||||
if file_err == ERR_FILE_NOT_FOUND:
|
||||
push_error("%s: file '%s' not found" % [_file_name, c_file_name])
|
||||
else:
|
||||
push_error(
|
||||
"%s: error opening file '%s': %s" % [_file_name, c_file_name, file_err]
|
||||
)
|
||||
push_error(
|
||||
"%s: error opening file '%s': %s" % [_file_name, c_file_name, error_string(file_err)]
|
||||
)
|
||||
return FAILED
|
||||
|
||||
var content := file.get_as_text()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user