X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fdb%2Ferror.py;h=c3fd3020a8499f3d6a452b1ffe22ca6795c79cb6;hb=c4f2731da69eaba5f4bb95583225a5399875f6fc;hp=084db6e2e8ecf14e2568f499a34e54a36891d013;hpb=991559357f6a03c3a5b70c053c8c2554aa8d5ee4;p=openvswitch diff --git a/python/ovs/db/error.py b/python/ovs/db/error.py index 084db6e2..c3fd3020 100644 --- a/python/ovs/db/error.py +++ b/python/ovs/db/error.py @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2010 Nicira Networks +# Copyright (c) 2009, 2010, 2011 Nicira Networks # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ import ovs.json + class Error(Exception): def __init__(self, msg, json=None, tag=None): - Exception.__init__(self) self.msg = msg self.json = json if tag is None: @@ -27,8 +27,8 @@ class Error(Exception): else: self.tag = tag - def __str__(self): + # Compose message. syntax = "" if self.json is not None: - syntax = "syntax \"%s\": " % ovs.json.to_string(self.json) - return "%s%s: %s" % (syntax, self.tag, self.msg) + syntax = 'syntax "%s": ' % ovs.json.to_string(self.json) + Exception.__init__(self, "%s%s: %s" % (syntax, self.tag, self.msg))