Handle error correctly

This commit is contained in:
osmarks 2018-08-13 11:23:46 +01:00
parent fca24f31c3
commit 9f774cf169

View File

@ -136,7 +136,7 @@ local function server(command)
local quantity_missing = 0
if not first_available then quantity_missing = command.quantity or 1
elseif command.quantity and command.quantity > first_available.item.count then quantity_missing = command.quantity - first_available.item.count end
if quantity_missing > 0 then return w.errors.make(w.errors.NOITEMS, { type = w.get_internal_identifier(command), quantity = quantity_missing }) end
if quantity_missing > 0 then error(w.errors.make(w.errors.NOITEMS, { type = w.get_internal_identifier(command), quantity = quantity_missing })) end
local items_moved_from_storage = fetch_by_location(first_available.location, command.quantity)