Sha256: 7dfa8dbb5052b13b70e97f011a06bd27310a4313904c9f9d4f4446b55a704489
Contents?: true
Size: 810 Bytes
Versions: 4
Compression:
Stored size: 810 Bytes
Contents
class Midori::Sandbox class << self def class_initialize @handlers = Hash.new @handlers[Midori::Exception::InternalError] = proc {|e| Midori::Response.new(500, {}, "#{e.inspect} #{e.backtrace}")} @handlers[Midori::Exception::NotFound] = proc {|_e| Midori::Response.new(404, {}, '404 Not Found')} end def add_rule(class_name, block) @handlers[class_name] = block end def capture(error) if @handlers[error.class].nil? @handlers[Midori::Exception::InternalError].call(error) else @handlers[error.class].call(error) end end def run(clean_room, function, *args) begin function.to_lambda(clean_room).call(*args) rescue StandardError => e capture(e) end end end class_initialize end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
em-midori-0.1.6.1 | lib/midori/sandbox.rb |
em-midori-0.1.6 | lib/midori/sandbox.rb |
em-midori-0.1.5.4 | lib/em-midori/sandbox.rb |
em-midori-0.1.5.3 | lib/em-midori/sandbox.rb |