Skip to content

Commit

Permalink
Prioritize web_console.exception when picking creation scheme
Browse files Browse the repository at this point in the history
It may happen that application code sets web_console.binding first and
then the app fails. The console pages will spawn a console in an
unexpected binding then.
  • Loading branch information
gsamokovarov committed Nov 24, 2014
1 parent 1312c70 commit d252134
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/web_console/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def call(env)

status, headers, body = @app.call(env)

if binding = env['web_console.binding']
session = REPLSession.create(binding: binding)
elsif exception = env['web_console.exception']
if exception = env['web_console.exception']
session = REPLSession.create(binding: exception.bindings.first, binding_stack: exception.bindings)
elsif binding = env['web_console.binding']
session = REPLSession.create(binding: binding)
end

if session && request.acceptable_content_type?
Expand Down

0 comments on commit d252134

Please sign in to comment.