[PATCH conductor 3/4] Rescues a possible exception when creating a ProviderImage
Matt Wagner
matt.wagner at redhat.com
Fri Dec 9 21:31:54 UTC 2011
Related to https://bugzilla.redhat.com/show_bug.cgi?id=761160
---
src/app/controllers/provider_images_controller.rb | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/provider_images_controller.rb b/src/app/controllers/provider_images_controller.rb
index 3f1eb36..c1467ca 100644
--- a/src/app/controllers/provider_images_controller.rb
+++ b/src/app/controllers/provider_images_controller.rb
@@ -26,9 +26,14 @@ class ProviderImagesController < ApplicationController
:build_id => params[:build_id],
:target_image_id => params[:target_image_id]
)
- if @provider_image.save
- flash[:notice] = t('provider_images.flash.notice.upload_start')
- else
+ begin
+ if @provider_image.save
+ flash[:notice] = t('provider_images.flash.notice.upload_start')
+ else
+ flash[:warning] = t('provider_images.flash.warning.upload_failed')
+ end
+ rescue Exception => e
+ logger.error "Caught exception importing image: #{e.message}"
flash[:warning] = t('provider_images.flash.warning.upload_failed')
end
redirect_to image_path(params[:image_id], :build => params[:build_id])
--
1.7.6.4
More information about the aeolus-devel
mailing list