exception_details 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -14,7 +14,7 @@ Features/benefits:
14
14
 
15
15
  * A single statement method for a loggable string (avoid repeating exception log string creation)
16
16
 
17
- * Get Pry like debug knowledge from cron job errors and running system logs without being there.
17
+ * Get Pry like debug knowledge from cron job errors and running systems from the log, without being there.
18
18
 
19
19
  * Pry type information with less overhead/dependencies--binding_of_caller is the only dependency.
20
20
 
@@ -24,7 +24,7 @@ Features/benefits:
24
24
  begin
25
25
  greeting = 'hello'
26
26
  @name = nil
27
- puts greeting + name
27
+ puts greeting + @name
28
28
  rescue Exception => e
29
29
  puts e.details
30
30
  puts e.inspect_variables
@@ -34,11 +34,11 @@ Features/benefits:
34
34
  e.details ->
35
35
 
36
36
  Exception:
37
- can't convert nil into String
37
+ TypeError: can't convert nil into String
38
38
  Variables:
39
- <String> greeting = "hello"
40
- <TypeError> e = #<TypeError: can't convert nil into String>
41
- <NilClass> @name = nil
39
+ <String> greeting = "hello"
40
+ <NilClass> @name = nil
41
+
42
42
  Backtrace:
43
43
  /Users/someguy/apps/exception_details/spec/exception_details_spec.rb:20:in `+'
44
44
  /Users/someguy/apps/exception_details/spec/exception_details_spec.rb:20:in `block (3 levels) in <top (required)>'
@@ -25,7 +25,7 @@ class Exception
25
25
  inspect_results = inspect_variables(options)
26
26
  parts = []
27
27
  parts << (options[:colorize] ? red('Exception:') : 'Exception:')
28
- parts << "\t" + message
28
+ parts << "\t" + "#{self.class.name}: #{message}"
29
29
  parts << (options[:colorize] ? red('Variables:') : 'Variables:')
30
30
  parts << inspect_results
31
31
  parts << (options[:colorize] ? red('Backtrace:') : 'Backtrace:')
@@ -19,8 +19,10 @@ module ExceptionDetails
19
19
  variable_names = target_binding.eval(variable_scope.to_s)
20
20
  variable_names.each do |vname|
21
21
  value = target_binding.eval(vname.to_s)
22
- variable_value_string = "\t<#{value.class}> #{vname} = #{value.inspect}"
23
- variable_strings << variable_value_string
22
+ variable_value_string = "\t" + sprintf("%-35s = %s", "<#{value.class}> #{vname}", value.inspect)
23
+ unless value == self # don't list the exception itself ...
24
+ variable_strings << variable_value_string
25
+ end
24
26
  end
25
27
  end
26
28
  variable_strings.sort
@@ -1,3 +1,3 @@
1
1
  module ExceptionDetails
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -11,6 +11,7 @@ describe "ExceptionDetails" do
11
11
  end
12
12
 
13
13
  context ".details" do
14
+
14
15
  it "should provide exception details method with back trace" do
15
16
  @e.details.include?('.rb').should be_true
16
17
  end
@@ -52,7 +53,7 @@ describe "ExceptionDetails" do
52
53
 
53
54
  it "should be available on grandchild subclasses" do
54
55
  begin
55
- # cause an arugument error
56
+ # cause an argument error
56
57
  should_be_in_output = true
57
58
  "UP".downcase("", "")
58
59
  rescue Exception => e
@@ -61,15 +62,16 @@ describe "ExceptionDetails" do
61
62
  end
62
63
  end
63
64
 
64
- pending "Need to investigate why NameError won't capture a binding (any takers?)" do
65
- it "should capture a binding for NameError" do
66
- begin
67
- reality_check = true
68
- 'hello' + made_up_variable
69
- rescue Exception =>e
70
- e.binding_during_exception.should be_an_instance_of Binding
71
- e.inspect_variables.include?("reality_check").should be_true
72
- end
65
+
66
+ it "should capture a binding for NameError" do
67
+ pending "Need to investigate why NameError won't capture a binding (any takers?)"
68
+ begin
69
+ reality_check = true
70
+ 'hello' + made_up_variable
71
+ rescue Exception => e
72
+ p e.inspect
73
+ e.binding_during_exception.should be_an_instance_of Binding
74
+ e.inspect_variables.include?("reality_check").should be_true
73
75
  end
74
76
  end
75
77
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_details
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-14 00:00:00.000000000 Z
12
+ date: 2013-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler