You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
I can't handle specific errors when I try to load my custom resource file in contrast to FileAccess.get_open_error() .
If an error occurs I'd like to know more about what caused it and having an error code is useful. Except there is none in ResourceLoader.
When an error occurs it is only printed in the debugger but it can't be used in the code directly.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I'd like to have a method in ResourceLoader with the same behavior than FileAccess.get_open_error() : A method which returns an error code when trying to load the resource.
Using the error code it'd help for things such as handling the error in the code, displaying a user friendly message to the player and many other useful things.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
# Let's assume ResourceLoader.get_open_error() is the method I want to usevarsave_game: Resource=load("user://my_resource.tres")
varerror=ResourceLoader.get_open_error()
iferror==ERR_FILE_NOT_FOUND:
print("File not found, create a new file with default values.")
eliferror==ERR_FILE_NO_PERMISSION:
printerr("Can't open the file: Permission denied!")
eliferror!=OK:
printerr("An unhandled error has occured. Error code: "+str(error))
If this enhancement will not be used often, can it be worked around with a few lines of script?
For now the only way I have found to handle errors without much control over it is:
Is there a reason why this should be core and not an add-on in the asset library?
I didn't find any way to handle errors via GDScript. FileAccess.get_open_error() has exactly this feature but I think loading a resource via ResourceLoader can have errors which are different from FileAccess under the hood. (EG: The resource file values mismatch, the file is not of type resource, etc...)
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
A save system which uses resources.
Describe the problem or limitation you are having in your project
I can't handle specific errors when I try to load my custom resource file in contrast to FileAccess.get_open_error() .
If an error occurs I'd like to know more about what caused it and having an error code is useful. Except there is none in ResourceLoader.
When an error occurs it is only printed in the debugger but it can't be used in the code directly.
The problem is explained entirely here: https://forum.godotengine.org/t/how-to-handle-resource-loading-error-resourceloader-load/97628
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I'd like to have a method in ResourceLoader with the same behavior than FileAccess.get_open_error() : A method which returns an error code when trying to load the resource.
Using the error code it'd help for things such as handling the error in the code, displaying a user friendly message to the player and many other useful things.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
For now the only way I have found to handle errors without much control over it is:
Is there a reason why this should be core and not an add-on in the asset library?
I didn't find any way to handle errors via GDScript. FileAccess.get_open_error() has exactly this feature but I think loading a resource via ResourceLoader can have errors which are different from FileAccess under the hood. (EG: The resource file values mismatch, the file is not of type resource, etc...)
The text was updated successfully, but these errors were encountered: