Permalink
Browse files

Remove exception handling, use something like Rack::ShowExceptions if…

… you want errors
  • Loading branch information...
1 parent 95d2807 commit 4b916908539913643661bd97166afdaf84de8fc7 @leehambley committed Aug 26, 2012
Showing with 18 additions and 29 deletions.
  1. +18 −29 lib/rack-thumb-proxy.rb
View
@@ -56,15 +56,10 @@ def validate_signature!
end
def retreive_upstream!
- begin
- open(request_url, 'rb') do |f|
- tempfile.binmode
- tempfile.write(f.read)
- tempfile.flush
- end
- rescue
- write_error_to_response!
- return false
+ open(request_url, 'rb') do |f|
+ tempfile.binmode
+ tempfile.write(f.read)
+ tempfile.flush
end
return true
end
@@ -94,33 +89,27 @@ def transform_image!
return true unless should_resize?
- begin
- require 'mapel'
+ require 'mapel'
- width, height = dimensions_from_request_options
- owidth, oheight = dimensions_from_tempfile
+ width, height = dimensions_from_request_options
+ owidth, oheight = dimensions_from_tempfile
- width = [width, owidth].min if width
- height = [height, oheight].min if height
+ width = [width, owidth].min if width
+ height = [height, oheight].min if height
- cmd = Mapel(tempfile_path)
+ cmd = Mapel(tempfile_path)
- if width && height
- cmd.gravity(request_gravity)
- cmd.resize!(width, height)
- else
- cmd.resize(width, height, 0, 0, '>')
- end
-
- cmd.to(tempfile_path).run
-
- rescue
- puts $!, $@
- write_error_to_response!
- return false
+ if width && height
+ cmd.gravity(request_gravity)
+ cmd.resize!(width, height)
+ else
+ cmd.resize(width, height, 0, 0, '>')
end
+ cmd.to(tempfile_path).run
+
true
+
end
def should_resize?

0 comments on commit 4b91690

Please sign in to comment.