8000 feat: Improve error handling · tj-python/github-deploy@e856456 · GitHub
[go: up one dir, main page]

Skip to content

Commit e856456

Browse files
authored
feat: Improve error handling
1 parent df5fbfa commit e856456

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

github_deploy/main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ def list_commands(self, ctx):
1717
def get_command(self, ctx, name):
1818
ns = {}
1919
fn = os.path.join(plugin_folder, name + '.py')
20-
with open(fn) as f:
21-
code = compile(f.read(), fn, ' 8149 ;exec')
22-
eval(code, ns, ns)
23-
return ns['main']
20+
21+
if os.path.exists(fn):
22+
with open(fn) as f:
23+
code = compile(f.read(), fn, 'exec')
24+
eval(code, ns, ns)
25+
return ns['main']
26+
27+
ctx.fail("Invalid Command: {name}".format(name=name))
2428

2529

2630
main = GithubDeploy(

0 commit comments

Comments
 (0)
0