diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2016-08-25 18:29:10 +0100 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2016-08-25 18:29:10 +0100 |
commit | dc173074018f34b2ae80209352bc989b896cf160 (patch) | |
tree | ad16141c3c0af17408526d806d906ba807434bfb /util.py | |
parent | c03d68da5431390e2f83bdc1c1e45f09e5cd3910 (diff) |
Catch more errors in case we're fed garbage through API calls
Don't hang or crash, that's bad.
Change-Id: I77114c20fe2431718eda8dbefde1c390fe8283d4
Diffstat (limited to 'util.py')
-rw-r--r-- | util.py | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -124,6 +124,9 @@ class VlanUtil: except ValueError as e: logging.error('perform_db_query(%s) got error %s', command, e) raise InputError("Invalid value in API call argument: %s" % e) + except TypeError as e: + logging.error('perform_db_query(%s) got error %s', command, e) + raise InputError("Invalid type in API call argument: %s" % e) return ret @@ -157,7 +160,10 @@ class VlanUtil: raise except ValueError as e: logging.error('perform_daemon_query(%s) got error %s', command, e) - raise InputError("Invalid value in API call: %s" % e) + raise InputError("Invalid value in API call argument: %s" % e) + except TypeError as e: + logging.error('perform_daemon_query(%s) got error %s', command, e) + raise InputError("Invalid type in API call argument: %s" % e) return ret @@ -200,7 +206,10 @@ class VlanUtil: raise except ValueError as e: logging.error('perform_db_update(%s) got error %s', command, e) - raise InputError("Invalid value in API call: %s" % e) + raise InputError("Invalid value in API call argument: %s" % e) + except TypeError as e: + logging.error('perform_db_update(%s) got error %s', command, e) + raise InputError("Invalid type in API call argument: %s" % e) return ret @@ -235,7 +244,10 @@ class VlanUtil: raise except ValueError as e: logging.error('perform_vlan_update(%s) got error %s', command, e) - raise InputError("Invalid value in API call: %s" % e) + raise InputError("Invalid value in API call argument: %s" % e) + except TypeError as e: + logging.error('perform_vlan_update(%s) got error %s', command, e) + raise InputError("Invalid type in API call argument: %s" % e) return ret |