to_exception 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e09804e0f8a6d4bb4a7fc04466507335dc364869
4
+ data.tar.gz: be8f49338b3c9471bb53d0ecb07787379e66fa2a
5
+ SHA512:
6
+ metadata.gz: 36336e4eb5aa9ddcf7f38131ff4e74e454b7bb50e84270644166b18867aa1262f7672d52064c7cf9d5638cb109ec327a6469f7f6fa143008edd4003633132b37
7
+ data.tar.gz: c0c53a831fbc9f893f6e7882f8f632170be5b971955a672e1b2d817c9e761e5b1a3ae1ff9ba7d7686a56644afbb3f932efa0b5175fd3dcb51ae41d23ba8d6074
@@ -0,0 +1,16 @@
1
+ == Example
2
+
3
+ class RenderError < StandardError; end
4
+
5
+ begin
6
+ unknown_method
7
+ rescue Exception => exception
8
+ # Raises RenderError exception preserving the NameError backtrace.
9
+ raise exception.to_exception(RenderError)
10
+ end
11
+
12
+ == Credits
13
+
14
+ Carlos Paramio
15
+
16
+ http://carlosparamio.com
@@ -0,0 +1,7 @@
1
+ class Exception
2
+ def to_exception(class_name, *args)
3
+ class_name.new(*args).tap do |new_exception|
4
+ new_exception.set_backtrace(backtrace)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "to_exception"
3
+ s.version = "0.0.1"
4
+ s.date = "2015-06-18"
5
+ s.summary = "Translates exceptions to other exception classes easily preserving the backtrace."
6
+ s.email = "hola@carlosparamio.com"
7
+ s.homepage = "http://github.com/carlosparamio/to_exception"
8
+ s.description = "Translates exceptions to other exception classes easily preserving the backtrace."
9
+ s.authors = ["Carlos Paramio"]
10
+
11
+ s.files = [
12
+ "README.rdoc",
13
+ "to_exception.gemspec",
14
+ "lib/to_exception.rb"
15
+ ]
16
+
17
+ s.has_rdoc = false
18
+ s.rdoc_options = ["--main", "README.rdoc"]
19
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: to_exception
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Paramio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Translates exceptions to other exception classes easily preserving the
14
+ backtrace.
15
+ email: hola@carlosparamio.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - README.rdoc
21
+ - lib/to_exception.rb
22
+ - to_exception.gemspec
23
+ homepage: http://github.com/carlosparamio/to_exception
24
+ licenses: []
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options:
28
+ - "--main"
29
+ - README.rdoc
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.2.2
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Translates exceptions to other exception classes easily preserving the backtrace.
48
+ test_files: []