On Fri, Feb 10, 2012 at 5:14 PM, tan yeun <tayetemp / gmail.com> wrote:
> Hi friends,
>
> I am developing a ruby software that depends on api from the other team
>
> Is there any good way to print the error message indicating it is
> generated from their api error?
>
> For example, there's a method provided from the api called foo()
>
> so when I do
> api.foo()
> it will return an error message : "foo error"
>
> when I develop my code, I want the error message to look like :
> "api: foo error"
>
> that way, when I see this error message, then I know it's the api error,
> not my code's error.
>
> So far the best practice I can think of is to wrap around all the
> methods
> provided by the api, for example
>
> class apiWrap

Your class name should be a constant => Start with an uppercase character.

>   >  >  
>   >  
>  >   >   >  
>  
> end
>
> any ideas?

Remove the begin rescue end. Seriously: if you cannot handle the error
by throwing another error or doing something else just le the original
exception pass.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/