Set status=500 when task fails