cause 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENCE.MIT +19 -0
- data/README.md +32 -0
- data/cause.gemspec +17 -0
- data/lib/cause.rb +12 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 365cb23d07fafcb0cf91d1b1c5a3c8420df01fc2
|
4
|
+
data.tar.gz: 0767c8590d5c1f98cb639fa7ccf1847771021672
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57f1de76e36988e40f3dfe0acf991ad47e251fd4f758ddb2e83dd30ee1902c27ca7ff3d8dacac64432667043e31bda44721e4537bc01244e09ac2cd582210c70
|
7
|
+
data.tar.gz: dfeb119002718e986a64222e379369b5f1e532b07651f370eeb643fa3cce4c8c8b143f2d850c1cfa05559b6b4fd54587e00fa5ce595b294f16a0daa7f456df83
|
data/LICENCE.MIT
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2013 Conrad Irwin <conrad@bugsnag.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
This is a back-port of Ruby 2.1.0's [`Exception#cause`](http://www.ruby-doc.org/core-2.1.0/Exception.html#method-i-cause) to older versions of Ruby.
|
2
|
+
|
3
|
+
Installation
|
4
|
+
------------
|
5
|
+
|
6
|
+
Add `gem 'cause'` to your `Gemfile`, then run `bundle install`. If you're not
|
7
|
+
using bundler, then just `gem install cause`.
|
8
|
+
|
9
|
+
Usage
|
10
|
+
-----
|
11
|
+
|
12
|
+
Just continue programming as normal. When you rescue from exceptions they'll
|
13
|
+
have a third property, cause, in addition to backtrace and message. The cause
|
14
|
+
is the exception object that was being handled when the error was raised.
|
15
|
+
|
16
|
+
While this is not directly useful in normal programming, it's very useful for
|
17
|
+
debugging. Exception trackers like [Bugsnag](https://bugsnag.com/) can then pick up
|
18
|
+
the cause of the exception to help you find out what went wrong.
|
19
|
+
|
20
|
+
Limitations
|
21
|
+
-----------
|
22
|
+
|
23
|
+
At the moment you cannot set the cause yourself. Overriding `raise` is hairy
|
24
|
+
business and I wrote this gem late at night, but with sufficient care it's
|
25
|
+
probably doable.
|
26
|
+
|
27
|
+
Meta-fu
|
28
|
+
-------
|
29
|
+
|
30
|
+
This gem is Copyright under the MIT licence. See LICENCE.MIT for details.
|
31
|
+
|
32
|
+
Contributions and bug-reports are welcome.
|
data/cause.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = 'cause'
|
3
|
+
gem.version = '0.1'
|
4
|
+
|
5
|
+
gem.summary = 'A backport of Exception#cause from Ruby 2.1.0'
|
6
|
+
gem.description = "Allows you access to the error that was being handled when this exception was raised."
|
7
|
+
|
8
|
+
gem.authors = ['Conrad Irwin']
|
9
|
+
gem.email = %w(conrad@bugsnag.com)
|
10
|
+
gem.homepage = 'http://github.com/ConradIrwin/cause'
|
11
|
+
|
12
|
+
gem.license = 'MIT'
|
13
|
+
|
14
|
+
gem.required_ruby_version = '>= 1.8.7'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
end
|
data/lib/cause.rb
ADDED
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cause
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Conrad Irwin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Allows you access to the error that was being handled when this exception
|
14
|
+
was raised.
|
15
|
+
email:
|
16
|
+
- conrad@bugsnag.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- LICENCE.MIT
|
22
|
+
- README.md
|
23
|
+
- cause.gemspec
|
24
|
+
- lib/cause.rb
|
25
|
+
homepage: http://github.com/ConradIrwin/cause
|
26
|
+
licenses:
|
27
|
+
- MIT
|
28
|
+
metadata: {}
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.8.7
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 2.0.3
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: A backport of Exception#cause from Ruby 2.1.0
|
49
|
+
test_files: []
|
50
|
+
has_rdoc:
|