Use throw_error() instead of plain throw