[Tarantool-patches] [PATCH resend v2 09/11] lua, datetime: time intervals support

Timur Safin tsafin at tarantool.org
Sat Jul 31 12:20:29 MSK 2021


: From: Oleg Babin <olegrok at tarantool.org>
: Subject: Re: [Tarantool-patches] [PATCH resend v2 09/11] lua, datetime: time
: intervals support
: 
: 
: On 31.07.2021 01:58, Timur Safin wrote:
: > :
: > : tarantool> return require('datetime').now() + 1
: > : ---
: > : - error: '[string "return require(''datetime'').now() + 1"]:1: Usage:
: > : datetime:__add(interval)'
: > : ...
: > :
: > :
: > : Looks a bit confusing. User doesn't know about metamethods.
: >
: > Partially agreed. Though I assume that users of this code will
: > be educated enough. But in any case, what would be your suggested
: > error message here?
: >
: In fact I don't know exactly.
: 
: But decimal shows something like:
: 
: ```
: 
: tarantool> decimal.new(1) + 'abc'
: ---
: - error: '[string "return decimal.new(1) + ''abc''"]:1: incorrect value
: to convert
:      to decimal as 2 argument'
: ...
: 
: ```

Very good, indeed. So the trick is to say that type is unexpected and optionally show of which value it's camplaining about.

Like:

Expected datetime or interval argument, but received '%s'.




More information about the Tarantool-patches mailing list