handle exceptions.