deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH core 3/3] Core: Display user-defined exception message
Date Wed, 29 Feb 2012 10:34:26 GMT

Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com



On Feb 28, 2012, at 12:32 AM, David Lutterkort wrote:

> On Mon, 2012-02-27 at 16:48 +0100, mfojtik@redhat.com wrote:
>> From: Michal Fojtik <mfojtik@redhat.com>
>> 
>> The exception handling DSL we're using allow user
>> to define custom exception message using the 'message'
>> directive. This message is then used in XML/HTML view
>> and client can fetch it.
>> However DC logs the original error message to system log.
>> This patch should make DC log user-defined message to log.
>> 
>> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> 
> ACK. One comment:
> 
>> diff --git a/server/lib/deltacloud/base_driver/exceptions.rb b/server/lib/deltacloud/base_driver/exceptions.rb
>> index e30f94c..08f2683 100644
>> --- a/server/lib/deltacloud/base_driver/exceptions.rb
>> +++ b/server/lib/deltacloud/base_driver/exceptions.rb
>> @@ -175,9 +175,10 @@ module Deltacloud
>>         report_method = $stderr.respond_to?(:err) ? :err : :puts
>>         Deltacloud::ExceptionHandler::exceptions.each do |exdef|
>>           if exdef.match?($!)
>> -            $stderr.send(report_method, "#{[$!.class.to_s, $!.message].join(':')}\n#{$!.backtrace.join("\n")}")
>>             new_exception = exdef.handler($!)
>> -            raise exdef.handler($!) if new_exception
>> +            m = new_exception.message.nil? ? $1.message : new_exception.message
> 
> That $1 is supposed to be a $!, right ?

Yes, seems like brain overflow. Thanks for spotting that.

  -- Michal


Mime
View raw message