Discussion:
Exception Hierarchy in Fog
Kyle Rames
2013-04-11 14:20:44 UTC
Permalink
I am currently making a change to the NotFound exception in the Rackspace
provider and I am a little confused about Fog's exception hierarchy.

There is a service specific (ie Fog::Storage::Rackspace::NotFound)
NotFound exception being created here:

https://github.com/fog/fog/blob/master/lib/fog/core/service.rb#L38-L39

And then it appears that provider specific
(Fog::Rackspace::Errors::NotFound) NotFound exception being created for a
couple providers:

https://github.com/fog/fog/blob/master/lib/fog/rackspace.rb#L12-L57
https://github.com/fog/fog/blob/master/lib/fog/hp.rb#L13-L56

I have a feeling that the second type is incorrect.

Thoughts?

Kyle
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
geemus (Wesley Beary)
2013-04-11 14:36:10 UTC
Permalink
I'd say probably the service specific ones are more correct. Also, at the
very least, the provider ones should inherit from Fog::Errors::NotFound
also, to provide for rescuing it the same regardless of provider. I should
think that a service level error should always be good enough for NotFound,
but perhaps there is a case where the scope is outside a particular service
and then a provider level NotFound would work (I'm unable to think of such
a case at present though.
Post by Kyle Rames
I am currently making a change to the NotFound exception in the Rackspace
provider and I am a little confused about Fog's exception hierarchy.
There is a service specific (ie Fog::Storage::Rackspace::NotFound)
https://github.com/fog/fog/blob/master/lib/fog/core/service.rb#L38-L39
And then it appears that provider specific
(Fog::Rackspace::Errors::NotFound) NotFound exception being created for a
https://github.com/fog/fog/blob/master/lib/fog/rackspace.rb#L12-L57
https://github.com/fog/fog/blob/master/lib/fog/hp.rb#L13-L56
I have a feeling that the second type is incorrect.
Thoughts?
Kyle
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Kyle Rames
2013-04-11 14:59:00 UTC
Permalink
Makes sense!

I figured people had created the provider level classes because they
weren't aware of the meta programmed service ones.

Kyle
Post by geemus (Wesley Beary)
I'd say probably the service specific ones are more correct. Also, at the
very least, the provider ones should inherit from Fog::Errors::NotFound
also, to provide for rescuing it the same regardless of provider. I should
think that a service level error should always be good enough for NotFound,
but perhaps there is a case where the scope is outside a particular service
and then a provider level NotFound would work (I'm unable to think of such
a case at present though.
Post by Kyle Rames
I am currently making a change to the NotFound exception in the Rackspace
provider and I am a little confused about Fog's exception hierarchy.
There is a service specific (ie Fog::Storage::Rackspace::NotFound)
https://github.com/fog/fog/blob/master/lib/fog/core/service.rb#L38-L39
And then it appears that provider specific
(Fog::Rackspace::Errors::NotFound) NotFound exception being created for a
https://github.com/fog/fog/blob/master/lib/fog/rackspace.rb#L12-L57
https://github.com/fog/fog/blob/master/lib/fog/hp.rb#L13-L56
I have a feeling that the second type is incorrect.
Thoughts?
Kyle
--
You received this message because you are subscribed to the Google Groups
"ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...