Skip to content

Commit 924e8ab

Browse files
authored
Fix printerr (#176)
* replace printerr with custom printerr * update override.cfg
1 parent c131223 commit 924e8ab

File tree

11 files changed

+588
-659
lines changed

11 files changed

+588
-659
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ default_env.tres
99
.import/
1010
export.cfg
1111
export_presets.cfg
12-
override.cfg
1312

1413
#
1514
# Mono-specific ignores

addons/godot-firebase/auth/auth.gd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func _set_config(config_json : Dictionary) -> void:
148148
# If false it will print an error
149149
func _is_ready() -> bool:
150150
if is_busy:
151-
printerr("Firebase Auth is currently busy and cannot process this request")
151+
Firebase._printerr("Firebase Auth is currently busy and cannot process this request")
152152
return false
153153
else:
154154
return true
@@ -242,7 +242,7 @@ func _on_FirebaseAuth_request_completed(result : int, response_code : int, heade
242242
var bod = body.get_string_from_utf8()
243243
var json_result = JSON.parse(bod)
244244
if json_result.error != OK:
245-
print_debug("Error while parsing body json")
245+
Firebase._printerr("Error while parsing body json")
246246
return
247247

248248
var res = json_result.result
@@ -285,12 +285,12 @@ func save_auth(auth : Dictionary) -> void:
285285
var encrypted_file = File.new()
286286
var err = encrypted_file.open_encrypted_with_pass("user://user.auth", File.WRITE, OS.get_unique_id())
287287
if err != OK:
288-
printerr("Error Opening File. Error Code: ", err)
288+
Firebase._printerr("Error Opening File. Error Code: "+ err)
289289
else:
290290
encrypted_file.store_line(to_json(auth))
291291
encrypted_file.close()
292292
else:
293-
printerr("OS Not supported for saving auth data")
293+
Firebase._printerr("OS Not supported for saving auth data")
294294

295295
# Function used to load the auth data file that has been stored locally
296296
# Note this does not work in HTML5 or UWP
@@ -299,20 +299,20 @@ func load_auth() -> void:
299299
var encrypted_file = File.new()
300300
var err = encrypted_file.open_encrypted_with_pass("user://user.auth", File.READ, OS.get_unique_id())
301301
if err != OK:
302-
printerr("Error Opening File. Error Code: ", err)
302+
Firebase._printerr("Error Opening File. Error Code: "+ err)
303303
else:
304304
var encrypted_file_data = parse_json(encrypted_file.get_line())
305305
manual_token_refresh(encrypted_file_data)
306306
else:
307-
printerr("OS Not supported for loading auth data")
307+
Firebase._printerr("OS Not supported for loading auth data")
308308

309309
# Function used to remove the local encrypted auth file
310310
func remove_auth() -> void:
311311
var dir = Directory.new()
312312
if (dir.file_exists("user://user.auth")):
313313
dir.remove("user://user.auth")
314314
else:
315-
printerr("No encrypted auth file exists")
315+
Firebase._printerr("No encrypted auth file exists")
316316

317317
# Function to check if there is an encrypted auth data file
318318
# If there is, the game will load it and refresh the token
@@ -321,7 +321,7 @@ func check_auth_file() -> void:
321321
if (dir.file_exists("user://user.auth")):
322322
load_auth()
323323
else:
324-
printerr("No encrypted auth file exists")
324+
Firebase._printerr("No encrypted auth file exists")
325325

326326
# Function used to change the email account for the currently logged in user
327327
func change_user_email(email : String) -> void:

addons/godot-firebase/firebase/firebase.gd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ onready var DynamicLinks : FirebaseDynamicLinks = $DynamicLinks
3939
var _config : Dictionary = {
4040
"apiKey": "",
4141
"authDomain": "",
42-
"databaseURL":"",
42+
"databaseURL": "",
4343
"projectId": "",
4444
"storageBucket": "",
4545
"messagingSenderId": "",
4646
"appId": "",
47+
"measurementId": "",
4748
"clientId": "",
4849
"clientSecret": "",
4950
"domainUriPrefix": "",
@@ -69,7 +70,10 @@ func _load_config() -> void:
6970
_config[key] = ProjectSettings.get_setting(env_var)
7071
else:
7172
if _config[key] == "":
72-
printerr("Configuration key '{key}' not found!".format({key = key}))
73+
_printerr("Configuration key '{key}' not found!".format({key = key}))
7374
else:
74-
printerr("No configuration settings found, add them in override.cfg file.")
75+
_printerr("No configuration settings found, add them in override.cfg file.")
7576
print("")
77+
78+
func _printerr(error : String) -> void:
79+
print("[Firebase Error] >> "+error)

addons/godot-firebase/firestore/firestore.gd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func _set_offline(value: bool) -> void:
271271
else:
272272
collection.update(document_id, FirestoreDocument.fields2dict(JSON.parse(content).result))
273273
else:
274-
printerr("Failed to retrieve cache %s! Error code: %d" % [cache, file.get_error()])
274+
Firebase._printerr("Failed to retrieve cache %s! Error code: %d" % [cache, file.get_error()])
275275
file.close()
276276
if deleted:
277277
cache_dir.remove(cache)
@@ -301,12 +301,12 @@ func _pooled_request(task : FirestoreTask) -> void:
301301
return
302302

303303
if not auth:
304-
printerr("Unauthenticated request issued...")
304+
Firebase._printerr("Unauthenticated request issued...")
305305
Firebase.Auth.login_anonymous()
306306
var result : Array = yield(Firebase.Auth, "auth_request")
307307
if result[0] != 1:
308308
_check_auth_error(result[0], result[1])
309-
printerr("Client connected as Anonymous")
309+
Firebase._printerr("Client connected as Anonymous")
310310

311311
task._headers = PoolStringArray([_AUTHORIZATION_HEADER + auth.idtoken])
312312

@@ -342,19 +342,19 @@ func _on_result_query(result : Array):
342342

343343
func _on_error(code : int, status : int, message : String):
344344
emit_signal("error", code, status, message)
345-
printerr(message)
345+
Firebase._printerr(message)
346346

347347
func _on_task_error(code : int, status : String, message : String):
348348
emit_signal("task_error", code, status, message)
349-
printerr(message)
349+
Firebase._printerr(message)
350350

351351
func _on_task_list_error(code : int, status : String, message : String):
352352
emit_signal("task_error", code, status, message)
353-
printerr(message)
353+
Firebase._printerr(message)
354354

355355
func _on_task_query_error(code : int, status : String, message : String):
356356
emit_signal("task_error", code, status, message)
357-
printerr(message)
357+
Firebase._printerr(message)
358358

359359
func _on_FirebaseAuth_login_succeeded(auth_result : Dictionary) -> void:
360360
auth = auth_result
@@ -385,4 +385,4 @@ func _check_auth_error(code : int, message : String) -> void:
385385
var err : String
386386
match code:
387387
400: err = "Please, enable Anonymous Sign-in method or Authenticate the Client before issuing a request (best option)"
388-
printerr(err)
388+
Firebase._printerr(err)

addons/godot-firebase/firestore/firestore_collection.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ func _process_request(task : FirestoreTask, document_id : String, url : String,
101101
task.connect("task_error", self, "_on_error")
102102

103103
if not auth:
104-
printerr("Unauthenticated request issued...")
104+
Firebase._printerr("Unauthenticated request issued...")
105105
Firebase.Auth.login_anonymous()
106106
var result : Array = yield(Firebase.Auth, "auth_request")
107107
if result[0] != 1:
108108
Firebase.Firestore._check_auth_error(result[0], result[1])
109109
return null
110-
printerr("Client authenticated as Anonymous User.")
110+
Firebase._printerr("Client authenticated as Anonymous User.")
111111

112112
task._url = url
113113
task._fields = fields
@@ -141,4 +141,4 @@ func _on_delete_document():
141141

142142
func _on_error(code, status, message):
143143
emit_signal("error", code, status, message)
144-
printerr(message)
144+
Firebase._printerr(message)

addons/godot-firebase/firestore/firestore_task.gd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func _handle_cache(offline : bool, data, encrypt_key : String, cache_path : Stri
200200
file.store_line(JSON.print(save))
201201
body_return = save
202202
else:
203-
printerr("Error saving cache file! Error code: %d" % file.get_error())
203+
Firebase._printerr("Error saving cache file! Error code: %d" % file.get_error())
204204
file.close()
205205

206206
Task.TASK_PATCH:
@@ -225,7 +225,7 @@ func _handle_cache(offline : bool, data, encrypt_key : String, cache_path : Stri
225225
if content != "--deleted--":
226226
save = JSON.parse(content).result
227227
else:
228-
printerr("Error updating cache file! Error code: %d" % file.get_error())
228+
Firebase._printerr("Error updating cache file! Error code: %d" % file.get_error())
229229
file.close()
230230

231231
save.fields = FirestoreDocument.dict2fields(_merge_dict(
@@ -245,7 +245,7 @@ func _handle_cache(offline : bool, data, encrypt_key : String, cache_path : Stri
245245
file.store_line(JSON.print(save))
246246
body_return = save
247247
else:
248-
printerr("Error updating cache file! Error code: %d" % file.get_error())
248+
Firebase._printerr("Error updating cache file! Error code: %d" % file.get_error())
249249
file.close()
250250

251251
Task.TASK_GET:
@@ -256,7 +256,7 @@ func _handle_cache(offline : bool, data, encrypt_key : String, cache_path : Stri
256256
if content != "--deleted--":
257257
body_return = JSON.parse(content).result
258258
else:
259-
printerr("Error reading cache file! Error code: %d" % file.get_error())
259+
Firebase._printerr("Error reading cache file! Error code: %d" % file.get_error())
260260
file.close()
261261

262262
Task.TASK_DELETE:
@@ -266,7 +266,7 @@ func _handle_cache(offline : bool, data, encrypt_key : String, cache_path : Stri
266266
file.store_line("--deleted--")
267267
body_return = {"deleted": true}
268268
else:
269-
printerr("Error \"deleting\" cache file! Error code: %d" % file.get_error())
269+
Firebase._printerr("Error \"deleting\" cache file! Error code: %d" % file.get_error())
270270
file.close()
271271
else:
272272
dir.remove(cache_path)
@@ -293,14 +293,14 @@ func _handle_cache(offline : bool, data, encrypt_key : String, cache_path : Stri
293293
if file.get_line().begins_with(data[0]):
294294
body_return.documents.append(JSON.parse(file.get_line()).result)
295295
else:
296-
printerr("Error opening cache file for listing! Error code: %d" % file.get_error())
296+
Firebase._printerr("Error opening cache file for listing! Error code: %d" % file.get_error())
297297
file.close()
298298
body_return.documents.resize(min(data[1], body_return.documents.size()))
299299
body_return.nextPageToken = ""
300300

301301
Task.TASK_QUERY:
302302
if offline:
303-
printerr("Offline queries are currently unsupported!")
303+
Firebase._printerr("Offline queries are currently unsupported!")
304304

305305
if not offline:
306306
return body

addons/gut/icon.png.import

Lines changed: 0 additions & 34 deletions
This file was deleted.

addons/http-sse-client/icon.png.import

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)