Skip to content

Commit 6fca9e2

Browse files
committed
Add more exception handling
1 parent 171daf8 commit 6fca9e2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

webduino_generator/project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ def compile(self, force_select=False, save=False):
252252

253253
# Get project output location
254254
sketch_path = self.get_sketch_path()
255+
if sketch_path is None:
256+
self.userio.error("Could not locate output files!")
255257
self.userio.print("Sketch located: " + sketch_path, verbose=True)
256258

257259
# Get target FQBN
@@ -269,6 +271,8 @@ def upload(self):
269271

270272
# Get project output location
271273
sketch_path = self.get_sketch_path()
274+
if sketch_path is None:
275+
self.userio.error("Could not locate output files!")
272276
self.userio.print("Sketch located: " + sketch_path, verbose=True)
273277

274278
# Get target FQBN

webduino_generator/userio.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,17 @@ def get_user(self, prompt: str, userText: str) -> Tuple[str, str]:
6262
if prompt is not None:
6363
self.console.print(prompt)
6464
self.console.print(userText, end="")
65-
userValue = input()
65+
try:
66+
userValue = input()
67+
except KeyboardInterrupt:
68+
exit(1)
6669
return userValue
6770

6871
def get_pass(self, prompt: str, passText: str) -> Tuple[str, str]:
6972
if prompt is not None:
7073
self.console.print(prompt)
71-
passValue = getpass.getpass(passText)
74+
try:
75+
passValue = getpass.getpass(passText)
76+
except KeyboardInterrupt:
77+
exit(1)
7278
return passValue

0 commit comments

Comments
 (0)