catching the exception when the image saving fails