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
  def initialize(api)
    @api = api
  end
  def foo
    begin
      @api.foo()
    rescue => e
      raise "api: #{e.message}"
    end
  end
end

any ideas?

thanks,

David

-- 
Posted via http://www.ruby-forum.com/.