[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3: assert non-string values in #2 cause `(no error message)`-style error message
- From: Tim Hill <drtimhill@...>
- Date: Sun, 19 Oct 2014 22:42:57 -0700
> On Oct 19, 2014, at 9:46 PM, Andrew Starks <andrew.starks@trms.com> wrote:
>
> This is related to Dirk's post:
>
> I had a bug that was hard to track down. It was caused by my test script's use of assert for a function that returns `false, error_message` as a return signature, where `error_message` is a table with key/value properties:
>
> ```
> local s = function(babies)
> if babies > 10 then
> return false, {416, "Too many babies."}
> end
>
> ---do lots of stuff, some of which could
> -- call `error`
>
> return {200, babies}
> end
Personally speaking, I’d say if you have more than 10 babies you should throw an error at once :)
—Tim