Skip to content

Commit 65f79c2

Browse files
fix storage error reporting
1 parent b2cb040 commit 65f79c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

addons/godot-firebase/storage/storage.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ func _check_emulating() -> void :
160160

161161
func _upload(data : PoolByteArray, headers : PoolStringArray, ref : StorageReference, meta_only : bool) -> StorageTask:
162162
if not (_config and _auth):
163+
Firebase._printerr("Error uploading to storage: Invalid authentication")
163164
return null
164165

165166
var task := StorageTask.new()
@@ -173,6 +174,7 @@ func _upload(data : PoolByteArray, headers : PoolStringArray, ref : StorageRefer
173174

174175
func _download(ref : StorageReference, meta_only : bool, url_only : bool) -> StorageTask:
175176
if not (_config and _auth):
177+
Firebase._printerr("Error downloading from storage: Invalid authentication")
176178
return null
177179

178180
var info_task := StorageTask.new()
@@ -207,6 +209,7 @@ func _download(ref : StorageReference, meta_only : bool, url_only : bool) -> Sto
207209

208210
func _list(ref : StorageReference, list_all : bool) -> StorageTask:
209211
if not (_config and _auth):
212+
Firebase._printerr("Error getting object list from storage: Invalid authentication")
210213
return null
211214

212215
var task := StorageTask.new()
@@ -218,6 +221,7 @@ func _list(ref : StorageReference, list_all : bool) -> StorageTask:
218221

219222
func _delete(ref : StorageReference) -> StorageTask:
220223
if not (_config and _auth):
224+
Firebase._printerr("Error deleting object from storage: Invalid authentication")
221225
return null
222226

223227
var task := StorageTask.new()
@@ -268,6 +272,8 @@ func _finish_request(result : int) -> void:
268272

269273
StorageTask.Task.TASK_DOWNLOAD_URL:
270274
var json : Dictionary = JSON.parse(_response_data.get_string_from_utf8()).result
275+
if json and json.has("error"):
276+
Firebase._printerr("Error getting download url: "+json["error"].message)
271277
if json and json.has("downloadTokens"):
272278
task.data = _base_url + _get_file_url(task.ref) + "?alt=media&token=" + json.downloadTokens
273279
else:
@@ -276,6 +282,8 @@ func _finish_request(result : int) -> void:
276282
StorageTask.Task.TASK_LIST, StorageTask.Task.TASK_LIST_ALL:
277283
var json : Dictionary = JSON.parse(_response_data.get_string_from_utf8()).result
278284
var items := []
285+
if json and json.has("error"):
286+
Firebase._printerr("Error getting data from storage: "+json["error"].message)
279287
if json and json.has("items"):
280288
for item in json.items:
281289
var item_name : String = item.name

0 commit comments

Comments
 (0)