"Error" is better with ``错误``. You use ``错误`` in some like line 59 and 66, but mostly using ``异常`` which means "unusual" or "abnormal".