Module: Rack::MogileFS::Endpoint::Rescues
- Included in:
- Rack::MogileFS::Endpoint
- Defined in:
- lib/rack/mogilefs/endpoint/rescues.rb
Overview
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rack/mogilefs/endpoint/rescues.rb', line 15 def call(env) if @options[:debug] super else with_rescues { super } end end |
#initialize ⇒ Object
10 11 12 13 |
# File 'lib/rack/mogilefs/endpoint/rescues.rb', line 10 def initialize(*) super @options[:debug] ||= false end |
#with_rescues ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rack/mogilefs/endpoint/rescues.rb', line 23 def with_rescues yield rescue ::MogileFS::Backend::UnknownKeyError => e [ 404, { "Content-Type" => "text/html" }, [e.] ] rescue ::MogileFS::UnreachableBackendError => e [ 503, { "Content-Type" => "text/html" }, [e.] ] rescue ::MogileFS::Error => e [ 500, { "Content-Type" => "text/html" }, [e.] ] end |