Introduce the error event, and modified the ready listener.