PointClickEngine::Core::ErrorHelpers
Utility methods for common error handling patterns
Instance methods
ensure_directory_exists(path : String) : Result(String, FileError)
Create directory if it doesn't exist
safe_execute(error_class : E.class, message : String, &block : -> T) : Result(T, E) forall T, E
Safely execute a block that might raise an exception
safe_file_write(path : String, content : String) : Result(Nil, FileError)
Safely write to a file
safe_load_music(path : String) : Result(RAudio::Music, AssetError)
Load music with error handling
safe_load_sound(path : String) : Result(RAudio::Sound, AssetError)
Load sound with error handling
safe_load_texture(path : String) : Result(Raylib::Texture2D, AssetError)
Load asset with error handling
validate_directory_exists(path : String) : Result(String, FileError)
Validate that a directory exists
validate_not_empty(value : String, field_name : String) : Result(String, ValidationError)
Validate that a string is not empty
validate_not_nil(value : T | Nil, error_message : String) : Result(T, ValidationError) forall T
Validate that a value is not nil
validate_range(value : T, min : T, max : T, field_name : String) : Result(T, ValidationError) forall T
Validate numeric range