Skip to content

Commit cd9b25d

Browse files
authored
Update ufirebase.py
1 parent 6126e74 commit cd9b25d

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

ufirebase.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import ujson
32
import usocket
43
import ussl
@@ -52,7 +51,10 @@ def put(PATH, DATA, id, cb):
5251
try:
5352
cb[0](*cb[1])
5453
except:
55-
cb[0](cb[1])
54+
try:
55+
cb[0](cb[1])
56+
except:
57+
raise OSError("Callback function could not be executed. Try the function without ufirebase.py callback.")
5658

5759

5860
def patch(PATH, DATATAG, id, cb):
@@ -75,7 +77,10 @@ def patch(PATH, DATATAG, id, cb):
7577
try:
7678
cb[0](*cb[1])
7779
except:
78-
cb[0](cb[1])
80+
try:
81+
cb[0](cb[1])
82+
except:
83+
raise OSError("Callback function could not be executed. Try the function without ufirebase.py callback.")
7984

8085
def get(PATH, DUMP, id, cb):
8186
try:
@@ -95,8 +100,10 @@ def get(PATH, DUMP, id, cb):
95100
try:
96101
cb[0](*cb[1])
97102
except:
98-
cb[0](cb[1])
99-
103+
try:
104+
cb[0](cb[1])
105+
except:
106+
raise OSError("Callback function could not be executed. Try the function without ufirebase.py callback.")
100107
def getfile(PATH, FILE, bg, id, cb):
101108
try:
102109
while FIREBASE_GLOBAL_VAR.SLIST["SS"+id]:
@@ -132,7 +139,10 @@ def getfile(PATH, FILE, bg, id, cb):
132139
try:
133140
cb[0](*cb[1])
134141
except:
135-
cb[0](cb[1])
142+
try:
143+
cb[0](cb[1])
144+
except:
145+
raise OSError("Callback function could not be executed. Try the function without ufirebase.py callback.")
136146

137147
def delete(PATH, id, cb):
138148
try:
@@ -152,7 +162,10 @@ def delete(PATH, id, cb):
152162
try:
153163
cb[0](*cb[1])
154164
except:
155-
cb[0](cb[1])
165+
try:
166+
cb[0](cb[1])
167+
except:
168+
raise OSError("Callback function could not be executed. Try the function without ufirebase.py callback.")
156169

157170
def addto(PATH, DATA, DUMP, id, cb):
158171
try:
@@ -175,7 +188,10 @@ def addto(PATH, DATA, DUMP, id, cb):
175188
try:
176189
cb[0](*cb[1])
177190
except:
178-
cb[0](cb[1])
191+
try:
192+
cb[0](cb[1])
193+
except:
194+
raise OSError("Callback function could not be executed. Try the function without ufirebase.py callback.")
179195

180196
def setURL(url):
181197
FIREBASE_GLOBAL_VAR.GLOBAL_URL=url

0 commit comments

Comments
 (0)