mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
handle invalid config
This commit is contained in:
parent
d8baa21e4e
commit
085fbb4769
4 changed files with 6 additions and 1 deletions
|
@ -3,11 +3,12 @@ class_name ConfigBase
|
|||
|
||||
var config: ConfigFile
|
||||
var config_path: String
|
||||
var load_result: Error
|
||||
|
||||
|
||||
func _init(path: String) -> void:
|
||||
config = ConfigFile.new()
|
||||
config.load(path)
|
||||
load_result = config.load(path)
|
||||
config_path = path
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ func load_gate(config_url: String) -> void:
|
|||
if config_path.is_empty(): return error(GateEvents.GateError.NOT_FOUND)
|
||||
|
||||
c_gate = ConfigGate.new(config_path, config_url)
|
||||
if c_gate.load_result != OK: return error(GateEvents.GateError.INVALID_CONFIG)
|
||||
gate_events.gate_config_loaded_emit(config_url, c_gate)
|
||||
|
||||
var image_path = await FileDownloader.download(c_gate.image_url)
|
||||
|
|
|
@ -15,6 +15,7 @@ signal gate_error(code: GateError)
|
|||
enum GateError
|
||||
{
|
||||
NOT_FOUND,
|
||||
INVALID_CONFIG,
|
||||
MISSING_PACK,
|
||||
MISSING_LIBS
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ func on_gate_error(code: GateEvents.GateError) -> void:
|
|||
match code:
|
||||
GateEvents.GateError.NOT_FOUND:
|
||||
set_text("Gate not found")
|
||||
GateEvents.GateError.INVALID_CONFIG:
|
||||
set_text("Invalid gate config")
|
||||
GateEvents.GateError.MISSING_PACK, GateEvents.GateError.MISSING_LIBS:
|
||||
set_text("Cannot load gate resources")
|
||||
_:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue