Class: Gallerist::RaiseWarmupExceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/gallerist/middleware/raise_warmup_exceptions.rb

Overview

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.

Copyright © 2015, Sebastian Staudt

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RaiseWarmupExceptions

Returns a new instance of RaiseWarmupExceptions.



8
9
10
# File 'lib/gallerist/middleware/raise_warmup_exceptions.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gallerist/middleware/raise_warmup_exceptions.rb', line 12

def call(env)
  @app.call env
rescue Exception
  if env['rack.warmup']
    if $!.is_a? SQLite3::BusyException
      raise Gallerist::LibraryInUseError, Gallerist::App.library_path
    end
  end

  raise $!
end