globally handle errors