lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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