Randomly responding with an error

Hi,

How do I randomly generate error? Something like this below doesn’t work (getting always 401)

if random(0, 2) > 1 then
  status 500
  { message: 'I was told to error' }
else 
  schema "Todos"
  generate 10  
end

Thanks, m.