aboutsummaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2016-08-25 18:29:10 +0100
committerSteve McIntyre <steve.mcintyre@linaro.org>2016-08-25 18:29:10 +0100
commitdc173074018f34b2ae80209352bc989b896cf160 (patch)
treead16141c3c0af17408526d806d906ba807434bfb /util.py
parentc03d68da5431390e2f83bdc1c1e45f09e5cd3910 (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.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/util.py b/util.py
index c110380..090e06e 100644
--- a/util.py
+++ b/util.py
@@ -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