pry-exception_explorer 0.1.3pre1 → 0.1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -11
- data/lib/pry-exception_explorer/core_ext.rb +21 -11
- data/lib/pry-exception_explorer/version.rb +1 -1
- data/pry-exception_explorer.gemspec +12 -12
- metadata +49 -42
data/README.md
CHANGED
@@ -5,24 +5,24 @@ pry-exception_explorer
|
|
5
5
|
|
6
6
|
_Enter the context of exceptions_
|
7
7
|
|
8
|
-
**Please note, this is a first release for pry-exception_explorer and as such it may still have teething
|
8
|
+
**Please note, this is a first release for pry-exception_explorer and as such it may still have teething
|
9
9
|
problems. If you encounter any quirks or crashes please [file an issue](https://github.com/pry/pry-exception_explorer/issues)**
|
10
10
|
|
11
|
-
`pry-exception_explorer` is an interactive error console for Ruby 1.9.2+ inspired by the [Hammertime](https://github.com/avdi/hammertime)
|
11
|
+
`pry-exception_explorer` is an interactive error console for Ruby 1.9.2+ inspired by the [Hammertime](https://github.com/avdi/hammertime)
|
12
12
|
gem, which was in turn inspired by consoles found in the Lisp and Smalltalk environments. `pry-exception_explorer` is a plugin
|
13
13
|
for the [Pry REPL](http://pry.github.com).
|
14
14
|
|
15
|
-
Using `pry-exception_explorer` we can automatically pull up a [Pry](http://pry.github.com) session at the point an exception arises and use `Pry`
|
15
|
+
Using `pry-exception_explorer` we can automatically pull up a [Pry](http://pry.github.com) session at the point an exception arises and use `Pry`
|
16
16
|
to inspect the state there to debug (and fix) the problem. We also get access to the entire call stack of the exception and can walk the stack to interactively examine the state in
|
17
17
|
parent frames (using [pry-stack_explorer](https://github.com/pry/pry-stack_explorer)).
|
18
18
|
|
19
|
-
**Watch the mini-screencast:** http://vimeo.com/
|
19
|
+
**Watch the mini-screencast:** http://vimeo.com/36061298
|
20
20
|
|
21
21
|
* Install the [gem](https://rubygems.org/gems/pry-exception_explorer): `gem install pry-exception_explorer`
|
22
22
|
* Read the [documentation](http://rdoc.info/github/banister/pry-exception_explorer/master/file/README.md)
|
23
23
|
* See the [source code](http://github.com/banister/pry-exception_explorer)
|
24
|
-
|
25
|
-
Example:
|
24
|
+
|
25
|
+
Example:
|
26
26
|
--------
|
27
27
|
|
28
28
|
In the Ruby file:
|
@@ -64,12 +64,12 @@ From: /Users/john/ruby/projects/pry-exception_explorer/examples/example_inline.r
|
|
64
64
|
18: x = "john"
|
65
65
|
19: gamma(x)
|
66
66
|
20: end
|
67
|
-
21:
|
67
|
+
21:
|
68
68
|
22: def gamma(x)
|
69
69
|
=> 23: raise ArgumentError, "x must be a number!" if !x.is_a?(Numeric)
|
70
70
|
24: puts "2 * x = #{2 * x}"
|
71
71
|
25: end
|
72
|
-
26:
|
72
|
+
26:
|
73
73
|
27: alpha
|
74
74
|
|
75
75
|
[1] (pry) main: 0> x
|
@@ -79,7 +79,7 @@ From: /Users/john/ruby/projects/pry-exception_explorer/examples/example_inline.r
|
|
79
79
|
[3] (pry) main: 0> continue-exception
|
80
80
|
```
|
81
81
|
|
82
|
-
Since we fixed the problem (invalid type for `x` local) we can `continue-exception`, and have the method continue with the
|
82
|
+
Since we fixed the problem (invalid type for `x` local) we can `continue-exception`, and have the method continue with the
|
83
83
|
amended `x`:
|
84
84
|
|
85
85
|
**PROGRAM OUTPUT:**
|
@@ -102,7 +102,7 @@ Features and limitations
|
|
102
102
|
|
103
103
|
### Limitations
|
104
104
|
|
105
|
-
* Only works on Ruby 1.9.2+ (including 1.9.3) MRI.
|
105
|
+
* Only works on Ruby 1.9.2+ (including 1.9.3) MRI.
|
106
106
|
* Limited support for `C` exceptions -- only some exceptions that arise from C code are caught.
|
107
107
|
* Wiki documentation coming soon ;)
|
108
108
|
|
@@ -115,7 +115,7 @@ Problems or questions contact me at [github](http://github.com/banister)
|
|
115
115
|
License
|
116
116
|
-------
|
117
117
|
|
118
|
-
(The MIT License)
|
118
|
+
(The MIT License)
|
119
119
|
|
120
120
|
Copyright (c) 2011 John Mair (banisterfiend)
|
121
121
|
|
@@ -22,28 +22,38 @@ class Object
|
|
22
22
|
# We monkey-patch the `raise` method so we can intercept exceptions
|
23
23
|
def raise(*args)
|
24
24
|
exception, string, array = args
|
25
|
+
|
25
26
|
if exception.is_a?(String)
|
26
27
|
string = exception
|
27
28
|
exception = RuntimeError
|
28
29
|
end
|
29
30
|
|
30
|
-
if
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
if !PryExceptionExplorer.enabled?
|
32
|
+
if exception.is_a?(Exception)
|
33
|
+
return super(*args)
|
34
|
+
elsif exception.nil?
|
35
|
+
if $!
|
36
|
+
return super($!)
|
37
|
+
else
|
38
|
+
return super(RuntimeError)
|
39
|
+
end
|
35
40
|
else
|
36
|
-
return super(
|
41
|
+
return super(*args)
|
37
42
|
end
|
38
|
-
|
43
|
+
end
|
44
|
+
|
45
|
+
if string
|
39
46
|
ex = exception.exception(string)
|
40
|
-
|
47
|
+
else
|
48
|
+
ex = exception.exception
|
41
49
|
end
|
42
50
|
|
51
|
+
ex.set_backtrace(array ? array : caller)
|
52
|
+
|
43
53
|
# revert to normal exception behaviour if EE not enabled.
|
44
|
-
if !PryExceptionExplorer.enabled?
|
45
|
-
|
46
|
-
end
|
54
|
+
# if !PryExceptionExplorer.enabled?
|
55
|
+
# return super(*args)
|
56
|
+
# end
|
47
57
|
|
48
58
|
intercept_object = PryExceptionExplorer.intercept_object
|
49
59
|
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "0.1.
|
4
|
+
s.name = %q{pry-exception_explorer}
|
5
|
+
s.version = "0.1.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = [
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
s.email =
|
12
|
-
s.files = [
|
13
|
-
s.homepage =
|
14
|
-
s.require_paths = [
|
15
|
-
s.rubygems_version =
|
16
|
-
s.summary =
|
17
|
-
s.test_files = [
|
8
|
+
s.authors = [%q{John Mair (banisterfiend)}]
|
9
|
+
s.date = %q{2012-02-02}
|
10
|
+
s.description = %q{Enter the context of exceptions}
|
11
|
+
s.email = %q{jrmair@gmail.com}
|
12
|
+
s.files = [%q{.gemtest}, %q{.gitignore}, %q{.travis.yml}, %q{.yardopts}, %q{CHANGELOG}, %q{Gemfile}, %q{LICENSE}, %q{README.md}, %q{Rakefile}, %q{examples/example_c_inline.rb}, %q{examples/example_inline.rb}, %q{examples/example_wrap.rb}, %q{lib/pry-exception_explorer.rb}, %q{lib/pry-exception_explorer/cli.rb}, %q{lib/pry-exception_explorer/commands.rb}, %q{lib/pry-exception_explorer/core_ext.rb}, %q{lib/pry-exception_explorer/intercept.rb}, %q{lib/pry-exception_explorer/lazy_frame.rb}, %q{lib/pry-exception_explorer/shim_builder.rb}, %q{lib/pry-exception_explorer/version.rb}, %q{pry-exception_explorer.gemspec}, %q{test/helper.rb}, %q{test/test_exceptions_in_pry.rb}, %q{test/test_inline_exceptions.rb}, %q{test/test_wrapped_exceptions.rb}]
|
13
|
+
s.homepage = %q{https://github.com/banister/pry-exception_explorer}
|
14
|
+
s.require_paths = [%q{lib}]
|
15
|
+
s.rubygems_version = %q{1.8.6}
|
16
|
+
s.summary = %q{Enter the context of exceptions}
|
17
|
+
s.test_files = [%q{test/helper.rb}, %q{test/test_exceptions_in_pry.rb}, %q{test/test_inline_exceptions.rb}, %q{test/test_wrapped_exceptions.rb}]
|
18
18
|
|
19
19
|
if s.respond_to? :specification_version then
|
20
20
|
s.specification_version = 3
|
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
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.3.1
|
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-02-03 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: *70366152722480
|
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
|
@@ -77,29 +81,32 @@ files:
|
|
77
81
|
- test/test_wrapped_exceptions.rb
|
78
82
|
homepage: https://github.com/banister/pry-exception_explorer
|
79
83
|
licenses: []
|
84
|
+
|
80
85
|
post_install_message:
|
81
86
|
rdoc_options: []
|
82
|
-
|
87
|
+
|
88
|
+
require_paths:
|
83
89
|
- lib
|
84
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
91
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
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
|
91
97
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version:
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
96
102
|
requirements: []
|
103
|
+
|
97
104
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.8.
|
105
|
+
rubygems_version: 1.8.11
|
99
106
|
signing_key:
|
100
107
|
specification_version: 3
|
101
108
|
summary: Enter the context of exceptions
|
102
|
-
test_files:
|
109
|
+
test_files:
|
103
110
|
- test/helper.rb
|
104
111
|
- test/test_exceptions_in_pry.rb
|
105
112
|
- test/test_inline_exceptions.rb
|