Hi Dies,

We're using a small DSL for capturing and dealing with different kind
of errors that came from backend provider. For that we have the 'safely',
block that you can see in many existing drivers.

A sample of using this:

def instances(credentials, opts={})
  client = new_client(...)
  safely do
    # do something that is can throw exception
  end
end

Then somewhere on bottom of the driver file, you can see this:

exceptions do

  on /(AuthFailure|InvalidKey)/ do
    status 401 # HTTP_AUTH
  end

  on /Error/ do
    status 502 # Provider error
  end

end

Then all exceptions are captured by this system and delivered to clients
in XML or JSON format with full backtrace.

 -- Michal

Michal Fojtik
http://deltacloud.org
[email protected]



On Apr 12, 2012, at 3:56 AM, Koper, Dies wrote:

> Hi,
> 
> While developing the FGCP driver, I often introduce bugs where I invoke
> [] on a nil object.
> When using the DC GUI, this causes the following backtrace:
> 
> NoMethodError - undefined method `code' for #<NameError:0x7fe779972da0>:
>       
> /mnt/hgfs/deltacloud/server/lib/deltacloud/helpers/application_helper.rb
> :69:in `filter_all'
>       /mnt/hgfs/deltacloud/server/lib/deltacloud/server.rb:676
> 
> The line is:
> 
>        report_error(@exception.code)
> 
> If I add a 'puts @exception.backtrace' in front of it it at least logs
> the backtrace to the bug in my bug.
> 
> Can we introduce such a chance here, and if we do, what kind of change
> would fit best?
> 
> Thanks,
> Dies Koper
> 

Reply via email to