mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
fix error handling in namespace
This commit is contained in:
parent
140dea2f09
commit
f10c80b00f
2 changed files with 6 additions and 2 deletions
|
@ -177,7 +177,7 @@ module Sinatra
|
|||
end
|
||||
|
||||
def errors
|
||||
base.errors.merge(@errors)
|
||||
base.errors.merge(namespace_errors)
|
||||
end
|
||||
|
||||
def namespace_errors
|
||||
|
@ -188,7 +188,10 @@ module Sinatra
|
|||
args = Sinatra::Base.send(:compile!, "ERROR", /^#{@pattern}/, block)
|
||||
codes = codes.map { |c| Array(c) }.flatten
|
||||
codes << Exception if codes.empty?
|
||||
codes.each { |c| @errors[c] = args }
|
||||
codes.each do |c|
|
||||
errors = @errors[c] ||= []
|
||||
errors << args
|
||||
end
|
||||
end
|
||||
|
||||
def respond_to(*args)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
ENV['RACK_ENV'] = 'test'
|
||||
require 'sinatra/contrib'
|
||||
|
||||
RSpec.configure do |config|
|
||||
|
|
Loading…
Reference in a new issue