summaryrefslogtreecommitdiff
path: root/openstackclient/common
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/common')
-rw-r--r--openstackclient/common/utils.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py
index b37ff806..475efeca 100644
--- a/openstackclient/common/utils.py
+++ b/openstackclient/common/utils.py
@@ -47,10 +47,17 @@ def find_resource(manager, name_or_id):
# finally try to find entity by name
try:
return manager.find(name=name_or_id)
- except exceptions.NotFound:
- msg = "No %s with a name or ID of '%s' exists." % \
- (manager.resource_class.__name__.lower(), name_or_id)
- raise exceptions.CommandError(msg)
+ # FIXME(dtroyer): The exception to catch here is dependent on which
+ # client library the manager passed in belongs to.
+ # Eventually this should be pulled from a common set
+ # of client exceptions.
+ except Exception as ex:
+ if '.NotFound' in type(ex).__name__:
+ msg = "No %s with a name or ID of '%s' exists." % \
+ (manager.resource_class.__name__.lower(), name_or_id)
+ raise exceptions.CommandError(msg)
+ else:
+ raise
def get_item_properties(item, fields, mixed_case_fields=[], formatters={}):