
On 09-08-2016 17:31, Paulo Ricardo Paz Vital wrote:
On Aug 09 04:15PM, Lucio Correia wrote:
Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> --- src/wok/exception.py | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/wok/exception.py b/src/wok/exception.py index f8f4bd4..3e8e058 100644 --- a/src/wok/exception.py +++ b/src/wok/exception.py @@ -30,6 +30,7 @@ class WokException(Exception): args = {} self.httpStatusCode = 500 self.code = code + self.params = args msg = WokMessage(code, args).get_text() cherrypy.log.error_log.error(msg) Exception.__init__(self, msg) @@ -37,6 +38,12 @@ class WokException(Exception): def getHttpStatusCode(self): return self.httpStatusCode
+ def getCode(self): + return self.code + + def getParams(self): + return self.params +
Using the same words of Aline's review in one of my patches: "Seems like too Java huh" :-DDDDD
You can directly access the attributes of an instanced class. For example:
bla = WokException(<arguments if necessary) params = bla.params
will be the same of:
bla = WokException(<arguments if necessary) params = bla.getParams()
OK, I will send V2, code will get simplified.
class NotFoundError(WokException): def __init__(self, code='', args=None): -- 1.9.1
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Lucio Correia Software Engineer IBM LTC Brazil