diff options
author | Alvaro Neira Ayuso <aneira@soleta.eu> | 2019-12-28 18:02:00 +0100 |
---|---|---|
committer | Alvaro Neira Ayuso <alvaroneay@gmail.com> | 2020-01-19 19:50:44 +0100 |
commit | e6eba4b91f0cfc54b33a4832b1a9de3816bbfd6e (patch) | |
tree | 578d57a1f19ae226bb1f2a163f7efa13bff7f340 /src/ogRest.py | |
parent | af903503a2424994f58a3adc42597451df569c65 (diff) |
(BUG) Handling command error
This patch adds support for handling the error when the command is wrong formed.
Now, if we send a shell/run command and the shell command is incomplete,
the program crashes.
Diffstat (limited to 'src/ogRest.py')
-rw-r--r-- | src/ogRest.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ogRest.py b/src/ogRest.py index c21fcbb..1e4a3ee 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -96,7 +96,13 @@ class ogRest(): client.send(self.getResponse(ogResponses.BAD_REQUEST)) return - ogThread.execcmd(self.msgqueue, cmd) + try: + ogThread.execcmd(self.msgqueue, cmd) + except ValueError as err: + print(err.args[0]) + client.send(self.getResponse(ogResponses.BAD_REQUEST)) + return + client.send(self.getResponse(ogResponses.OK)) def process_shellout(self, client): |