Skip to content
Browse files

UploadController: detect parsing exceptions in small uploads

  • Loading branch information...
1 parent 29138df commit 777b9b2f8ab565cac844deaaa9b3167994e1ab04 @etdsoft etdsoft committed Feb 4, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 app/controllers/upload_controller.rb
View
7 app/controllers/upload_controller.rb
@@ -112,7 +112,12 @@ def parse
if File.size(attachment.fullpath) < 1024*1024
logger = Log.new(:uid => item_id)
logger.write('Small attachment detected. Processing in line.')
- @uploader.import(:file => attachment.fullpath, :logger => logger)
+ begin
+ @uploader.import(:file => attachment.fullpath, :logger => logger)
+ rescue Exception => e
+ logger.write('There was a fatal error processing your upload:')
+ logger.write(e.message)
+ end
logger.write('Worker process completed.')
else
Log.new(:uid => item_id).write("Enqueueing job to start in the background. Job id is #{item_id}")

0 comments on commit 777b9b2

Please sign in to comment.
Something went wrong with that request. Please try again.