[Nitro] param handling
Jonathan Buch
john at oxyliquit.de
Fri Oct 27 10:16:01 EDT 2006
Hi,
>> def action(par1, par2)
>> GET /action
>> { :arguments => [nil, nil], :params => {} }
>> return error
>> * The first can also be created by normal Ruby means:
>> `def action(par1 = nil, par2 = nil)`
> I would vote for the first possibility here because if it happens that
> an action is called without the required parameters, the developer could
> respond with an error message that exactly fits the error. The second
> possibility would just return a general "too few arguments" error.
thought a little more about what you said here.
That general "too few arguments" error would only appear with
`def action(par1, par2)` and not with `def action(par1 = nil, par2 = nil)`.
IMHO the first says: This function does not handle the case where both
parameters are missing.
The second says: just push me whatever, I'll handle it.
For custom error handling, the second would be used, the first will
just throw an error.
Am I just thinking too much here?
Jonathan
--
Feel the love
http://pinkjuice.com/pics/ruby.png
More information about the Nitro-general
mailing list