I would throw something custom instead, the error method does a system exit.