diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-08-23 09:58:49 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-08-24 11:57:43 -0700 |
| commit | f09aa106ee66e387d68c339cdcd7426a01c4bf8d (patch) | |
| tree | a14a28bd4eab544e865b747e71ba057cc4077506 /python | |
| parent | 1a98f75260289f72d430abef026c6da2b1d5a255 (diff) | |
| download | openvswitch-f09aa106ee66e387d68c339cdcd7426a01c4bf8d.tar.gz | |
ovs.db.types: Simplify code to avoid try/except case.
Also fixes a typo that caused one version of the error message to have a
hyphen and the other to have a space.
Suggested-by: Reid Price <reid@nicira.com>
Diffstat (limited to 'python')
| -rw-r--r-- | python/ovs/db/types.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py index f7bc2482b..416d7456b 100644 --- a/python/ovs/db/types.py +++ b/python/ovs/db/types.py @@ -30,16 +30,14 @@ class AtomicType(object): for atomic_type in ATOMIC_TYPES: if s == atomic_type.name: return atomic_type - raise error.Error('"%s" is not an atomic type' % s) + raise error.Error('"%s" is not an atomic-type' % s, s) @staticmethod def from_json(json): if type(json) not in [str, unicode]: raise error.Error("atomic-type expected", json) - try: + else: return AtomicType.from_string(json) - except error.Error: - raise error.Error('"%s" is not an atomic-type' % json, json) def __str__(self): return self.name |
