handle 'error' event on spawn