human_error 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d614b3e79926582dbf282a7e05f85dd8efdeceda
4
+ data.tar.gz: 3dde7cb56afebb5614dd2a14b4afd6129bbb344d
5
+ SHA512:
6
+ metadata.gz: 114f36605d067ddca3a8177a01f5d4aa9c8217898015a6a2de30b3bf7ba0e472beca0572097a9e5bdd218fea3bfaea2702b130860b77502e57a43bd43c261502
7
+ data.tar.gz: 958028969aa5fa69fe61808ec2c7acabf448a7083632637aed696622eb1dbd4c43484d60c51577b181936b02281400b1614a019b4f3c98ffe6c19f7821693b0b
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # HumanError
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'human_error'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install human_error
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/human_error/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ require 'human_error/version'
2
+ require 'human_error/error'
3
+
4
+ module HumanError
5
+ end
@@ -0,0 +1,9 @@
1
+ module HumanError
2
+ module Error
3
+ def wrap(other)
4
+ wrapped_error = new "#{other.class.name}: #{other.message}"
5
+ wrapped_error.set_backtrace other.backtrace
6
+ wrapped_error
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module HumanError
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,32 @@
1
+ require 'rspectacular'
2
+ require 'human_error/error'
3
+
4
+ class CustomError < RuntimeError
5
+ extend HumanError::Error
6
+ end
7
+
8
+ module HumanError
9
+ describe Error do
10
+ it 'can wrap an error with another error' do
11
+ original_error = RuntimeError.new('My Runtime Error Message')
12
+ wrapped_error = CustomError.wrap(original_error)
13
+
14
+ expect(wrapped_error.class.name).to eql 'CustomError'
15
+ end
16
+
17
+ it 'can wrap the message of an error by identifying the original error type' do
18
+ original_error = RuntimeError.new('My Runtime Error Message')
19
+ wrapped_error = CustomError.wrap(original_error)
20
+
21
+ expect(wrapped_error.message).to eql 'RuntimeError: My Runtime Error Message'
22
+ end
23
+
24
+ it 'can transfer the backtrace of the original error to the wrapped error' do
25
+ original_error = RuntimeError.new('My Runtime Error Message')
26
+ original_error.set_backtrace %w{foo bar baz}
27
+ wrapped_error = CustomError.wrap(original_error)
28
+
29
+ expect(wrapped_error.backtrace).to eql %w{foo bar baz}
30
+ end
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: human_error
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - jfelchner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.beta
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.beta
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspectacular
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.19'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.19'
41
+ description: ''
42
+ email: accounts+git@thekompanee.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files:
46
+ - README.md
47
+ files:
48
+ - README.md
49
+ - Rakefile
50
+ - lib/human_error.rb
51
+ - lib/human_error/error.rb
52
+ - lib/human_error/version.rb
53
+ - spec/lib/human_error/error_spec.rb
54
+ homepage: https://github.com/thekompanee/human_error
55
+ licenses: []
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options:
59
+ - "--charset = UTF-8"
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project: human_error
74
+ rubygems_version: 2.2.2
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Common Error Extensions and Helpers
78
+ test_files:
79
+ - spec/lib/human_error/error_spec.rb
80
+ has_rdoc: