pry-exception_explorer 0.1.1pre7 → 0.1.1pre8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -0
- data/examples/example_c_inline.rb +27 -0
- data/lib/pry-exception_explorer.rb +24 -4
- data/lib/pry-exception_explorer/cli.rb +1 -1
- data/lib/pry-exception_explorer/commands.rb +10 -9
- data/lib/pry-exception_explorer/core_ext.rb +6 -2
- data/lib/pry-exception_explorer/intercept.rb +53 -19
- data/lib/pry-exception_explorer/lazy_frame.rb +17 -7
- data/lib/pry-exception_explorer/shim_builder.rb +13 -21
- data/lib/pry-exception_explorer/version.rb +1 -1
- data/pry-exception_explorer.gemspec +3 -3
- data/test/test_inline_exceptions.rb +54 -6
- metadata +47 -39
data/Rakefile
CHANGED
@@ -53,6 +53,20 @@ task :example_inline do
|
|
53
53
|
sh "ruby -I#{direc}/lib/ #{direc}/examples/example_inline.rb "
|
54
54
|
end
|
55
55
|
|
56
|
+
desc "Run example C inline"
|
57
|
+
task :example_c_inline do
|
58
|
+
require 'pry-exception_explorer/shim_builder'
|
59
|
+
binary_name = "lib_overrides.#{PryExceptionExplorer::ShimBuilder::Dyname}"
|
60
|
+
if RUBY_PLATFORM =~ /darwin/
|
61
|
+
ENV['DYLD_FORCE_FLAT_NAMESPACE'] = "1"
|
62
|
+
ENV['DYLD_INSERT_LIBRARIES'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
|
63
|
+
else
|
64
|
+
ENV['LD_PRELOAD'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
|
65
|
+
end
|
66
|
+
|
67
|
+
sh "ruby -I#{direc}/lib/ #{direc}/examples/example_c_inline.rb "
|
68
|
+
end
|
69
|
+
|
56
70
|
task :default => :test
|
57
71
|
|
58
72
|
desc "Show version"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
unless Object.const_defined? :PryExceptionExplorer
|
2
|
+
$:.unshift File.expand_path '../../lib', __FILE__
|
3
|
+
require 'pry'
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'pry-exception_explorer'
|
7
|
+
|
8
|
+
PryExceptionExplorer.enabled = true
|
9
|
+
PryExceptionExplorer.intercept(NameError)
|
10
|
+
|
11
|
+
def alpha
|
12
|
+
name = "john"
|
13
|
+
beta
|
14
|
+
puts name
|
15
|
+
end
|
16
|
+
|
17
|
+
def beta
|
18
|
+
x = 20
|
19
|
+
gamma
|
20
|
+
puts x
|
21
|
+
end
|
22
|
+
|
23
|
+
def gamma
|
24
|
+
UnknownConstant
|
25
|
+
end
|
26
|
+
|
27
|
+
alpha
|
@@ -99,13 +99,11 @@ module PryExceptionExplorer
|
|
99
99
|
def intercept(*exceptions, &block)
|
100
100
|
return if exceptions.empty? && block.nil?
|
101
101
|
|
102
|
-
options = (exceptions.pop if exceptions.last.is_a?(Hash)) || {}
|
103
|
-
|
104
102
|
if !exceptions.empty?
|
105
103
|
block = proc { |_, ex| exceptions.any? { |v| v === ex } }
|
106
104
|
end
|
107
105
|
|
108
|
-
local_hash[:intercept_object] = Intercept.new(block
|
106
|
+
local_hash[:intercept_object] = Intercept.new(block)
|
109
107
|
end
|
110
108
|
|
111
109
|
# @return [PryExceptionExplorer::Intercept] The object defined earlier by a call to `PryExceptionExplorer.intercept`.
|
@@ -131,6 +129,28 @@ module PryExceptionExplorer
|
|
131
129
|
end
|
132
130
|
end
|
133
131
|
|
132
|
+
# Amends (destructively) an exception call stack according to the info in
|
133
|
+
# `PryExceptionExplorer.intercept_object`, specifically
|
134
|
+
# `PryExceptionExplorer::Intercept#skip_until_block` and `PryExceptionExplorer::Intercept#skip_while_block`.
|
135
|
+
# @param [Exception] ex The exception whose call stack will be amended.
|
136
|
+
def amend_exception_call_stack!(ex)
|
137
|
+
call_stack = ex.exception_call_stack
|
138
|
+
|
139
|
+
if intercept_object.skip_until_block
|
140
|
+
idx = call_stack.each_with_index.find_index do |frame, idx|
|
141
|
+
intercept_object.skip_until_block.call(LazyFrame.new(frame, idx, call_stack))
|
142
|
+
end
|
143
|
+
call_stack = call_stack.drop(idx) if idx
|
144
|
+
elsif intercept_object.skip_while_block
|
145
|
+
idx = call_stack.each_with_index.find_index do |frame, idx|
|
146
|
+
intercept_object.skip_while_block.call(LazyFrame.new(frame, idx, call_stack)) == false
|
147
|
+
end
|
148
|
+
call_stack = call_stack.drop(idx) if idx
|
149
|
+
end
|
150
|
+
|
151
|
+
ex.exception_call_stack = call_stack
|
152
|
+
end
|
153
|
+
|
134
154
|
# Prepare the `Pry` instance and associated call-stack when entering
|
135
155
|
# into an exception context.
|
136
156
|
# @param [Exception] ex The exception.
|
@@ -154,7 +174,7 @@ module PryExceptionExplorer
|
|
154
174
|
def enter_exception(ex, options={})
|
155
175
|
hooks = Pry.config.hooks.dup.add_hook(:before_session, :set_exception_flag) do |_, _, _pry_|
|
156
176
|
setup_exception_context(ex, _pry_, options)
|
157
|
-
end.add_hook(:before_session, :manage_intercept_recurse) do
|
177
|
+
end.add_hook(:before_session, :manage_intercept_recurse) do
|
158
178
|
PryExceptionExplorer.intercept_object.disable! if !PryExceptionExplorer.intercept_object.intercept_recurse?
|
159
179
|
end.add_hook(:after_session, :manage_intercept_recurse) do
|
160
180
|
PryExceptionExplorer.intercept_object.enable! if !PryExceptionExplorer.intercept_object.active?
|
@@ -16,6 +16,16 @@ module PryExceptionExplorer
|
|
16
16
|
def enterable_exception?
|
17
17
|
last_exception && last_exception.exception_call_stack
|
18
18
|
end
|
19
|
+
|
20
|
+
def inline_exception?
|
21
|
+
frame_manager && frame_manager.user[:exception] &&
|
22
|
+
frame_manager.user[:inline_exception]
|
23
|
+
end
|
24
|
+
|
25
|
+
def normal_exception?
|
26
|
+
frame_manager && frame_manager.user[:exception] &&
|
27
|
+
frame_manager.user[:exception].continuation
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
31
|
Commands = Pry::CommandSet.new do
|
@@ -84,15 +94,6 @@ module PryExceptionExplorer
|
|
84
94
|
raise Pry::CommandError, "No exception to continue!"
|
85
95
|
end
|
86
96
|
end
|
87
|
-
|
88
|
-
private
|
89
|
-
def inline_exception?
|
90
|
-
frame_manager && frame_manager.user[:exception] && frame_manager.user[:inline_exception]
|
91
|
-
end
|
92
|
-
|
93
|
-
def normal_exception?
|
94
|
-
frame_manager && frame_manager.user[:exception] && frame_manager.user[:exception].continuation
|
95
|
-
end
|
96
97
|
end
|
97
98
|
|
98
99
|
end
|
@@ -31,12 +31,16 @@ class Object
|
|
31
31
|
ex.set_backtrace(array)
|
32
32
|
|
33
33
|
# revert to normal exception behaviour if EE not enabled.
|
34
|
-
if !PryExceptionExplorer.enabled?
|
34
|
+
if !PryExceptionExplorer.enabled?
|
35
35
|
return super(ex)
|
36
36
|
end
|
37
37
|
|
38
|
+
intercept_object = PryExceptionExplorer.intercept_object
|
39
|
+
|
38
40
|
if PryExceptionExplorer.should_intercept_exception?(binding.of_caller(1), ex)
|
39
|
-
ex.exception_call_stack = binding.callers.tap { |v| v.shift(1 +
|
41
|
+
ex.exception_call_stack = binding.callers.tap { |v| v.shift(1 + intercept_object.skip_num) }
|
42
|
+
PryExceptionExplorer.amend_exception_call_stack!(ex)
|
43
|
+
|
40
44
|
ex.should_intercept = true
|
41
45
|
|
42
46
|
if !PryExceptionExplorer.wrap_active?
|
@@ -1,41 +1,75 @@
|
|
1
1
|
module PryExceptionExplorer
|
2
2
|
class Intercept
|
3
3
|
|
4
|
+
# @return [Proc] The predicate block that determines if
|
5
|
+
# interception takes place.
|
6
|
+
attr_reader :block
|
7
|
+
|
4
8
|
# @return [Fixnum] Number of frames to skip when session starts.
|
5
|
-
|
9
|
+
attr_reader :skip_num
|
10
|
+
|
11
|
+
# @return [Proc] The block that defines the frames to skip.
|
12
|
+
attr_reader :skip_while_block
|
6
13
|
|
7
|
-
# @return [
|
8
|
-
|
9
|
-
alias_method :intercept_recurse?, :intercept_recurse
|
14
|
+
# @return [Proc] The block that determines when to stop skipping frames.
|
15
|
+
attr_reader :skip_until_block
|
10
16
|
|
11
17
|
# @return [Boolean] Whether this intercept object is active
|
12
18
|
# If it's inactive then calling it will always return `false`
|
13
19
|
# regardless of content inside block.
|
14
|
-
def active?()
|
20
|
+
def active?() !!@active end
|
15
21
|
|
16
22
|
# Disable the intercept object.
|
17
|
-
|
23
|
+
# @return [PryExceptionExplorer::Intercept] The receiver
|
24
|
+
def disable!() tap { @active = false } end
|
18
25
|
|
19
26
|
# Enable if the intercept object.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
#
|
24
|
-
|
27
|
+
# @return [PryExceptionExplorer::Intercept] The receiver
|
28
|
+
def enable!() tap { @active = true } end
|
29
|
+
|
30
|
+
# @param [Fixnum] num Number of frames to skip when session
|
31
|
+
# starts.
|
32
|
+
# @return [PryExceptionExplorer::Intercept] The receiver
|
33
|
+
def skip(num) tap { @skip_num = num } end
|
34
|
+
|
35
|
+
# @yield [lazy_frame] The block that defines the frames to
|
36
|
+
# skip. The Pry session will start on the first frame for which
|
37
|
+
# this block evalutes to `false`.
|
38
|
+
# @yieldparam [PryExceptionExplorer::LazyFrame] lazy_frame
|
39
|
+
# @yieldreturn [Boolean]
|
40
|
+
# @return [PryExceptionExplorer::Intercept] The receiver
|
41
|
+
def skip_while(&block) tap { @skip_while_block = block } end
|
42
|
+
|
43
|
+
# @yield [lazy_frame] The block that determines when to stop skipping frames.
|
44
|
+
# The Pry session will start on the first frame for which
|
45
|
+
# this block evalutes to `true`.
|
46
|
+
# @yieldparam [PryExceptionExplorer::LazyFrame] lazy_frame
|
47
|
+
# @yieldreturn [Boolean]
|
48
|
+
# @return [PryExceptionExplorer::Intercept] The receiver
|
49
|
+
def skip_until(&block) tap { @skip_until_block = block } end
|
50
|
+
|
51
|
+
# @param [Boolean] should_recurse Whether to intercept exceptions
|
52
|
+
# raised inside the session.
|
53
|
+
# @return [PryExceptionExplorer::Intercept] The receiver
|
54
|
+
def intercept_recurse(should_recurse) tap { @intercept_recurse = should_recurse } end
|
25
55
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:intercept_recurse => false
|
30
|
-
}.merge!(options)
|
56
|
+
# @return [Boolean] Whether exceptions raised inside the session
|
57
|
+
# will be intercepted.
|
58
|
+
def intercept_recurse?() !!@intercept_recurse end
|
31
59
|
|
32
|
-
|
33
|
-
|
34
|
-
|
60
|
+
def initialize(block)
|
61
|
+
skip(0)
|
62
|
+
intercept_recurse(false)
|
35
63
|
|
64
|
+
@block = block
|
36
65
|
@active = true
|
37
66
|
end
|
38
67
|
|
68
|
+
# Invoke the associated block for this
|
69
|
+
# `PryExceptionExplorer::Intercept` object. Note that the block is
|
70
|
+
# not invoked if the intercept object is inactive.
|
71
|
+
# @param [Array] args The parameters to
|
72
|
+
# @return [Boolean] Determines whether a given exception should be intercepted.
|
39
73
|
def call(*args)
|
40
74
|
active? && @block.call(*args)
|
41
75
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module PryExceptionExplorer
|
2
2
|
class LazyFrame
|
3
|
+
class NullFrame
|
4
|
+
def klass() nil end
|
5
|
+
def self() nil end
|
6
|
+
def method_name() nil end
|
7
|
+
def prev() self end
|
8
|
+
end
|
3
9
|
|
4
10
|
# we need to jump over a few irrelevant frames to begin with
|
5
11
|
START_FRAME_OFFSET = 6
|
6
12
|
|
7
|
-
def initialize(frame, frame_counter = 0)
|
13
|
+
def initialize(frame, frame_counter = 0, call_stack = nil)
|
8
14
|
@frame = frame
|
9
15
|
@frame_counter = frame_counter
|
10
|
-
|
11
|
-
|
12
|
-
# @return [Binding] The `Binding` object that represents the frame.
|
13
|
-
def raw_frame
|
14
|
-
@frame
|
16
|
+
@call_stack = call_stack
|
15
17
|
end
|
16
18
|
|
17
19
|
# @return [Class] The class of the `self` of the frame.
|
@@ -31,7 +33,15 @@ module PryExceptionExplorer
|
|
31
33
|
|
32
34
|
# @return [LazyFrame] The caller frame.
|
33
35
|
def prev
|
34
|
-
|
36
|
+
if @call_stack
|
37
|
+
if @frame_counter < (@call_stack.size - 1)
|
38
|
+
LazyFrame.new(@call_stack[@frame_counter + 1], @frame_counter + 1, @call_stack)
|
39
|
+
else
|
40
|
+
NullFrame.new
|
41
|
+
end
|
42
|
+
else
|
43
|
+
LazyFrame.new(binding.of_caller(@frame_counter + START_FRAME_OFFSET), @frame_counter + 1)
|
44
|
+
end
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
@@ -2,12 +2,14 @@ require 'rbconfig'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
module PryExceptionExplorer
|
5
|
+
CompileError = Class.new(StandardError)
|
6
|
+
|
5
7
|
module ShimBuilder
|
6
8
|
class << self
|
7
9
|
attr_reader :dir, :file
|
8
10
|
end
|
9
11
|
|
10
|
-
@dir = File.expand_path(
|
12
|
+
@dir = File.expand_path("~/.pry-exception_explorer/#{RUBY_VERSION}")
|
11
13
|
@file = File.join(@dir, "raise_shim.c")
|
12
14
|
|
13
15
|
if RUBY_PLATFORM =~ /darwin/
|
@@ -26,27 +28,15 @@ module PryExceptionExplorer
|
|
26
28
|
void
|
27
29
|
rb_raise(unsigned long exc, const char *fmt, ...)
|
28
30
|
{
|
29
|
-
static void (*libruby_rb_raise)
|
30
|
-
(unsigned long exc, const char *fmt, ...) = NULL;
|
31
|
-
|
32
|
-
void * handle;
|
33
|
-
char * error;
|
34
|
-
|
35
|
-
if (!libruby_rb_raise) {
|
36
|
-
handle = dlopen("#{RbConfig::CONFIG['libdir']}/libruby.#{Dyname}", RTLD_LAZY);
|
37
|
-
if (!handle) {
|
38
|
-
fputs(dlerror(), stderr);
|
39
|
-
exit(1);
|
40
|
-
}
|
41
|
-
libruby_rb_raise = dlsym(handle, "rb_raise");
|
42
|
-
if ((error = dlerror()) != NULL) {
|
43
|
-
fprintf(stderr, "%s", error);
|
44
|
-
exit(1);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
31
|
rb_funcall(rb_cObject, rb_intern("raise"), 2, exc, rb_str_new2("hooked exception (pry)"));
|
49
32
|
}
|
33
|
+
|
34
|
+
void
|
35
|
+
rb_name_error(ID id, const char *fmt, ...)
|
36
|
+
{
|
37
|
+
rb_funcall(rb_cObject, rb_intern("raise"), 2, rb_eNameError, rb_str_new2("hooked exception (pry)"));
|
38
|
+
}
|
39
|
+
|
50
40
|
EOF
|
51
41
|
|
52
42
|
def self.create_directory_and_source_file
|
@@ -74,7 +64,9 @@ EOF
|
|
74
64
|
end
|
75
65
|
|
76
66
|
FileUtils.chdir @dir do
|
77
|
-
system(compile_line)
|
67
|
+
if !system(compile_line)
|
68
|
+
raise CompileError, "There was a problem building the shim, aborted!"
|
69
|
+
end
|
78
70
|
end
|
79
71
|
|
80
72
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "pry-exception_explorer"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1pre8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["John Mair (banisterfiend)"]
|
9
|
-
s.date = "2012-01-
|
9
|
+
s.date = "2012-01-31"
|
10
10
|
s.description = "Enter the context of exceptions"
|
11
11
|
s.email = "jrmair@gmail.com"
|
12
|
-
s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "Gemfile", "LICENSE", "README.md", "Rakefile", "examples/example_inline.rb", "examples/example_wrap.rb", "lib/pry-exception_explorer.rb", "lib/pry-exception_explorer/cli.rb", "lib/pry-exception_explorer/commands.rb", "lib/pry-exception_explorer/core_ext.rb", "lib/pry-exception_explorer/intercept.rb", "lib/pry-exception_explorer/lazy_frame.rb", "lib/pry-exception_explorer/shim_builder.rb", "lib/pry-exception_explorer/version.rb", "pry-exception_explorer.gemspec", "test/helper.rb", "test/test_exceptions_in_pry.rb", "test/test_inline_exceptions.rb", "test/test_wrapped_exceptions.rb"]
|
12
|
+
s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "Gemfile", "LICENSE", "README.md", "Rakefile", "examples/example_c_inline.rb", "examples/example_inline.rb", "examples/example_wrap.rb", "lib/pry-exception_explorer.rb", "lib/pry-exception_explorer/cli.rb", "lib/pry-exception_explorer/commands.rb", "lib/pry-exception_explorer/core_ext.rb", "lib/pry-exception_explorer/intercept.rb", "lib/pry-exception_explorer/lazy_frame.rb", "lib/pry-exception_explorer/shim_builder.rb", "lib/pry-exception_explorer/version.rb", "pry-exception_explorer.gemspec", "test/helper.rb", "test/test_exceptions_in_pry.rb", "test/test_inline_exceptions.rb", "test/test_wrapped_exceptions.rb"]
|
13
13
|
s.homepage = "https://github.com/banister/pry-exception_explorer"
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.rubygems_version = "1.8.11"
|
@@ -69,31 +69,31 @@ describe PryExceptionExplorer do
|
|
69
69
|
"O.after_self = self",
|
70
70
|
"continue-exception",
|
71
71
|
"continue-exception")) do
|
72
|
-
Ratty.new.ratty
|
72
|
+
Ratty.new.ratty
|
73
73
|
end
|
74
74
|
|
75
75
|
O.before_self.should == O.after_self
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'should allow recursive (in-session) interceptions when :intercept_recurse => true' do
|
79
|
-
EE.intercept
|
79
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.intercept_recurse(true)
|
80
80
|
|
81
81
|
redirect_pry_io(InputTester.new("O.before_self = self",
|
82
82
|
"Ratty.new.ratty",
|
83
83
|
"O.after_self = self",
|
84
84
|
"continue-exception",
|
85
85
|
"continue-exception")) do
|
86
|
-
Ratty.new.ratty
|
86
|
+
Ratty.new.ratty
|
87
87
|
end
|
88
88
|
|
89
89
|
O.before_self.should.not == O.after_self
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
end
|
93
93
|
|
94
94
|
describe "skip" do
|
95
95
|
it 'should skip first frame with :skip => 1' do
|
96
|
-
EE.intercept
|
96
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.skip(1)
|
97
97
|
|
98
98
|
redirect_pry_io(InputTester.new("O.method_name = __method__",
|
99
99
|
"continue-exception")) do
|
@@ -104,7 +104,7 @@ describe PryExceptionExplorer do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should skip first two framed with :skip => 2' do
|
107
|
-
EE.intercept
|
107
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.skip(2)
|
108
108
|
|
109
109
|
redirect_pry_io(InputTester.new("O.method_name = __method__",
|
110
110
|
"continue-exception")) do
|
@@ -115,6 +115,54 @@ describe PryExceptionExplorer do
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
describe "skip_until" do
|
119
|
+
it 'should skip frames until it finds a frame that meets the predicate' do
|
120
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.skip_until { |frame| frame.prev.method_name == :ratty }
|
121
|
+
|
122
|
+
redirect_pry_io(InputTester.new("O.method_name = __method__",
|
123
|
+
"continue-exception")) do
|
124
|
+
Ratty.new.ratty
|
125
|
+
end
|
126
|
+
|
127
|
+
O.method_name.should == :weasel
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'should not skip any frames if predicate not met' do
|
131
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.skip_until { |frame| frame.prev.method_name == :will_not_be_matched }
|
132
|
+
|
133
|
+
redirect_pry_io(InputTester.new("O.method_name = __method__",
|
134
|
+
"continue-exception")) do
|
135
|
+
Ratty.new.ratty
|
136
|
+
end
|
137
|
+
|
138
|
+
O.method_name.should == :toad
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe "skip_while" do
|
143
|
+
it 'should skip frames while no frames meets the predicate' do
|
144
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.skip_while { |frame| frame.prev.method_name != :ratty }
|
145
|
+
|
146
|
+
redirect_pry_io(InputTester.new("O.method_name = __method__",
|
147
|
+
"continue-exception")) do
|
148
|
+
Ratty.new.ratty
|
149
|
+
end
|
150
|
+
|
151
|
+
O.method_name.should == :weasel
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'should not skip any frames if predicate not met' do
|
155
|
+
EE.intercept { |frame, ex| frame.klass == Toad }.skip_while { |frame| frame.prev.method_name != :will_not_be_matched }
|
156
|
+
|
157
|
+
redirect_pry_io(InputTester.new("O.method_name = __method__",
|
158
|
+
"continue-exception")) do
|
159
|
+
Ratty.new.ratty
|
160
|
+
end
|
161
|
+
|
162
|
+
O.method_name.should == :toad
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
118
166
|
describe "special case exception-only syntax" do
|
119
167
|
|
120
168
|
describe "single exception" do
|
metadata
CHANGED
@@ -1,55 +1,59 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-exception_explorer
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1pre7
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease: 5
|
5
|
+
version: 0.1.1pre8
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- John Mair (banisterfiend)
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
date: 2012-01-31 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
15
16
|
name: pry-stack_explorer
|
16
|
-
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
19
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version:
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
22
24
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
26
27
|
name: bacon
|
27
|
-
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
30
|
none: false
|
29
|
-
requirements:
|
31
|
+
requirements:
|
30
32
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
33
|
+
- !ruby/object:Gem::Version
|
32
34
|
version: 1.1.0
|
33
35
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
37
38
|
name: rake
|
38
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
|
-
requirements:
|
42
|
+
requirements:
|
41
43
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0.9"
|
44
46
|
type: :development
|
45
|
-
|
46
|
-
version_requirements: *70111600093540
|
47
|
+
version_requirements: *id003
|
47
48
|
description: Enter the context of exceptions
|
48
49
|
email: jrmair@gmail.com
|
49
50
|
executables: []
|
51
|
+
|
50
52
|
extensions: []
|
53
|
+
|
51
54
|
extra_rdoc_files: []
|
52
|
-
|
55
|
+
|
56
|
+
files:
|
53
57
|
- .gemtest
|
54
58
|
- .gitignore
|
55
59
|
- .travis.yml
|
@@ -59,6 +63,7 @@ files:
|
|
59
63
|
- LICENSE
|
60
64
|
- README.md
|
61
65
|
- Rakefile
|
66
|
+
- examples/example_c_inline.rb
|
62
67
|
- examples/example_inline.rb
|
63
68
|
- examples/example_wrap.rb
|
64
69
|
- lib/pry-exception_explorer.rb
|
@@ -76,29 +81,32 @@ files:
|
|
76
81
|
- test/test_wrapped_exceptions.rb
|
77
82
|
homepage: https://github.com/banister/pry-exception_explorer
|
78
83
|
licenses: []
|
84
|
+
|
79
85
|
post_install_message:
|
80
86
|
rdoc_options: []
|
81
|
-
|
87
|
+
|
88
|
+
require_paths:
|
82
89
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
91
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
97
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
98
|
+
requirements:
|
99
|
+
- - ">"
|
100
|
+
- !ruby/object:Gem::Version
|
94
101
|
version: 1.3.1
|
95
102
|
requirements: []
|
103
|
+
|
96
104
|
rubyforge_project:
|
97
105
|
rubygems_version: 1.8.11
|
98
106
|
signing_key:
|
99
107
|
specification_version: 3
|
100
108
|
summary: Enter the context of exceptions
|
101
|
-
test_files:
|
109
|
+
test_files:
|
102
110
|
- test/helper.rb
|
103
111
|
- test/test_exceptions_in_pry.rb
|
104
112
|
- test/test_inline_exceptions.rb
|