it is necessary catch  the error in case that you have a problem saving the image