implement 'error' event