Diego Medina wrote:
> On Tue, Aug 25, 2009 at 1:56 PM, Monty Taylor<[email protected]> wrote:
>> Jay Pipes wrote:
>>> Jim Starkey wrote:
>>>> Jay Pipes wrote:
>>>>> Diego Medina wrote:
> 
>> BUT, once we hit multi-tenancy stuff, doing the translations of strings
>> sent from the server to the client server side is going to stop being
>> the right place to do it. In that case, I agree with Jim's original idea
>> here (or some portion of my interpretation of it) which is that if we
>> send an error _code_ from the server, and the _client_ grabs the code
>> and produces text, then the gettext localization can happen client side.
>> This does mean that for errors that need parameters to be sensible, we
>> might need to be able to return an error and a list of one or more items
>> of data about that error. (like key-value pairs - or even a table...)
> 
> I really like this idea.
> 
>>> I think with a fairly simple change, we can clean this interface up a
>>> bit.  I propose adding two protected member variables to Item_func:
>>>
>>> protected:
>>>   uint32_t min_num_args;
>>>   uint32_t max_num_args;
>>>
>>> And have a new protected method hasCorrectArguments():
>>>
>>> Item_func::hasCorrectArguments() const
>>> {
>>>   return (arg_count >= min_num_args && arg_count <= max_num_args);
>>> }
>>>
>>> And change the existing check_argument_count() method to the following:
>>>
>>> Item_func::checkArguments()
>>> {
>>>   if (! hasCorrectArguments())
>>>   {
>>>     my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION,
>>>              _("Incorrect number of arguments supplied to function "
>>>                "\"%s\".  Expected between %" PRIu32 " and %" PRIu32 "
>>>                " arguments but received %" PRIu32 "."),
>>>              func_name(),
>>>              min_num_args,
>>>              max_num_args,
>>>              arg_count);
>>>   }
>>> }
>>>
>>> Thoughts?
> 
> This looks easier to implement than the idea of sending just the error
> code and one or more arguments to help create the error message.
> Would it make sense to do the easier implementation now, and have a
> blueprint for the "nicer" way to handle error messages?

Yes. Absolutely! We are all about doing things in digestible chunks.

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to