diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-03-02 23:05:03 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-03-02 23:05:03 +0100 |
commit | 200f0e9a93ec9039d2fb5a2e519f2dd424a9d814 (patch) | |
tree | 0d28d1b0b1bb5532b7d1d0a8300c324c2c63630c /Tools | |
parent | 7a0db340f7363a678963e5761a006ac099d94c54 (diff) | |
download | px4-firmware-200f0e9a93ec9039d2fb5a2e519f2dd424a9d814.tar.gz px4-firmware-200f0e9a93ec9039d2fb5a2e519f2dd424a9d814.tar.bz2 px4-firmware-200f0e9a93ec9039d2fb5a2e519f2dd424a9d814.zip |
Better error handling for multi-board setups
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/px_uploader.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py index 91ac084ef..859c821e5 100755 --- a/Tools/px_uploader.py +++ b/Tools/px_uploader.py @@ -416,7 +416,7 @@ class uploader(object): def upload(self, fw): # Make sure we are doing the right thing if self.board_type != fw.property('board_id'): - raise RuntimeError("Firmware not suitable for this board") + raise IOError("Firmware not suitable for this board") if self.fw_maxsize < fw.property('image_size'): raise RuntimeError("Firmware image is too large for this board") @@ -564,13 +564,12 @@ try: up.upload(fw) except RuntimeError as ex: + # print the error + print("\nERROR: %s" % ex.args) - if "not suitable" in ex.args: - up.close() - continue - else: - # print the error - print("\nERROR: %s" % ex.args) + except IOError as e: + up.close(); + continue finally: # always close the port |