middleman/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb
Thomas Reynolds a95dbb6367 Collections
2014-10-15 14:34:53 -05:00

19 lines
531 B
Ruby

require 'rack/showexceptions'
# Support rack/showexceptions during development
module Middleman::CoreExtensions
class ShowExceptions < ::Middleman::Extension
def initialize(app, options_hash={}, &block)
super
return if app.config.defines_setting? :show_exceptions
app.config.define_setting :show_exceptions, !!ENV['TEST'], 'Whether to catch and display exceptions'
end
def after_configuration
app.use ::Rack::ShowExceptions if !app.build? && app.config[:show_exceptions]
end
end
end