Bradford Cottel created THRIFT-1887:
---------------------------------------
Summary: Thrift::ApplicationException::initialize has incorrect
order of arguments
Key: THRIFT-1887
URL: https://issues.apache.org/jira/browse/THRIFT-1887
Project: Thrift
Issue Type: Bug
Components: Ruby - Library
Reporter: Bradford Cottel
In order to work correctly with RSpec (and probably Test::Unit as well), the
first argument to the constructor (def initialize) for
Thrift::ApplicationException should be message.
Namely,
def initialize(type=UNKNOWN, message=nil)
Should instead be,
def initialize(message=nil, type=UNKNOWN)
So that when I do something like this in RSpec (which is the 'normal' standard
way of doing it):
fake.should_receive(:some_message).and_raise(Thrift::ApplicationException,
'someMessage failed: unknown result')
It will just 'work' (because the first parameter to the initialize is all that
is needed, that is, the message itself).
Instead, I now have to pass in the :type as well as the message, even though I
don't care about the :type, which is verbose and non-intuitive, and probably
confuses newbies to Thrift:
fake.should_receive(:find_product_by_id).and_raise(Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT,
'findProductById failed: unknown result'))
In fact, I can even do the following and it works just as well for my purposes:
fake.should_receive(:find_product_by_id).and_raise(Thrift::ApplicationException.new(nil,
'findProductById failed: unknown result')) # pass in nil for type
Even though perhaps it's easier for the builders of this library to have type
first, it's not easier for the users. I think the latter should be considered
first, when matters of confusion and convenience are at hand.
Thanks for listening. I'm leaving this as 'major' instead of 'minor' because I
think it has the potential for a good deal of confusion when using Thrift.
Feel free to re-prioritize as you see fit, of course. :-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira