class Gallerist::RaiseWarmupExceptions

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

Public Class Methods

new(app) click to toggle source
# File lib/gallerist/middleware/raise_warmup_exceptions.rb, line 8
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# 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