handle error event.