Skip to content

Commit 3a107f6

Browse files
committed
Added error handling
1 parent ccd4ba6 commit 3a107f6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@
1313
contact_info=os.getenv('contact')
1414

1515
#Connect to Turbowarp's cloud server or another cloud server
16-
turbo_conn = scratch3.TwCloudConnection(project_id=scratch_project, username=username, cloud_host=server, purpose="A bot that syncs Scratch variables to another cloud server", contact=contact_info)
16+
try:
17+
turbo_conn = scratch3.TwCloudConnection(project_id=scratch_project, username=username, cloud_host=server, purpose="A bot that syncs Scratch variables to another cloud server", contact=contact_info)
18+
except:
19+
print("Couldn't connect to the cloud server. Closing the program.")
20+
exit()
1721

1822
set_vars = None
1923
while True:
2024
#Get a dictionary of the cloud variables on Scratch
2125
variables = scratch3.get_cloud(scratch_project)
26+
if variables == {} or variables == None:
27+
print("Something went wrong while retrieving the cloud variable list or there are no cloud variables in the project. Closing.")
28+
exit()
2229
#Sets these variables in Turbowarp
2330
if set_vars == variables: continue
2431
for var in variables:

0 commit comments

Comments
 (0)