output error if error occurs