[Kimchi-devel] [PATCH] [Wok 1/3] Update WokException to store code and args
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Aug 22 14:14:14 UTC 2016
On 08/09/2016 05:31 PM, Paulo Ricardo Paz Vital wrote:
> On Aug 09 04:15PM, Lucio Correia wrote:
>> Signed-off-by: Lucio Correia <luciojhc at 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
;-D
> 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()
>
>> class NotFoundError(WokException):
>> def __init__(self, code='', args=None):
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Kimchi-devel mailing list
>> Kimchi-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
More information about the Kimchi-devel
mailing list