lib/flapjack/api.rb in flapjack-0.6.36 vs lib/flapjack/api.rb in flapjack-0.6.37
- old
+ new
@@ -45,12 +45,17 @@
module Flapjack
class API < Sinatra::Base
- # doesn't work with Rack::Test for some reason
- unless 'test'.eql?(FLAPJACK_ENV)
+ set :show_exceptions, false
+
+ if 'test'.eql?(FLAPJACK_ENV)
+ # expose test errors properly
+ set :raise_errors, true
+ else
+ # doesn't work with Rack::Test unless we wrap tests in EM.synchrony blocks
rescue_exception = Proc.new { |env, exception|
logger.error exception.message
logger.error exception.backtrace.join("\n")
[503, {}, {:errors => [exception.message]}.to_json]
}
@@ -59,11 +64,9 @@
end
use Rack::MethodOverride
use Rack::JsonParamsParser
extend Flapjack::Pikelet
-
- set :show_exceptions, 'development'.eql?(FLAPJACK_ENV)
before do
# will only initialise the first time it's run
Flapjack::API.bootstrap
end