caze 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +9 -3
- data/CHANGELOG.md +8 -0
- data/lib/caze.rb +13 -7
- data/lib/caze/version.rb +1 -1
- data/spec/caze_spec.rb +5 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2bb9ec264807b18d2af5846a4c66316f2f1854
|
4
|
+
data.tar.gz: b4f5fff37ac8572f2d80c1ea2e7132f1fa625823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a93472e3a66c94d6b22437c1db6d0c818336f1eedf57974ed664b1dc18ae469e3851b42dfabfbfab895362f36e655f345d27dd5855eb9967ec69fa43f82bf5ee
|
7
|
+
data.tar.gz: 2af9f0ed062310c5f61352837197012b64552569e24103d64bbb19d4d9724cebcae54537cd11bcee6f512f541c4a3fb2060e07a001e74f017520c353abdc99cd
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
## [0.2.1] - 2017-12-19
|
9
|
+
|
10
|
+
- Fixed how the exceptions constants are created when `raise_use_case_exception`
|
11
|
+
is on. The exceptions will inherit from `StandardError`, live under the
|
12
|
+
use case constant and won't throw any already initialized constant warnings.
|
13
|
+
|
6
14
|
## [0.2.1] - 2016-02-29
|
7
15
|
|
8
16
|
### Change
|
data/lib/caze.rb
CHANGED
@@ -30,6 +30,8 @@ module Caze
|
|
30
30
|
else
|
31
31
|
use_case.send(use_case_name, *args)
|
32
32
|
end
|
33
|
+
rescue NoTransactionMethodError
|
34
|
+
raise
|
33
35
|
rescue => e
|
34
36
|
if raise_use_case_exception
|
35
37
|
raise raise_use_case_error(use_case, e)
|
@@ -62,17 +64,21 @@ module Caze
|
|
62
64
|
# This method intends to inject the error inside the context of the use case,
|
63
65
|
# so we can identify the use case from it was raised
|
64
66
|
def raise_use_case_error(use_case, error)
|
65
|
-
|
67
|
+
name = error.class.name.split('::').last
|
66
68
|
|
67
|
-
|
69
|
+
klass = define_use_case_error(use_case, name)
|
70
|
+
wrapped = klass.new(error.message)
|
71
|
+
wrapped.set_backtrace(error.backtrace)
|
68
72
|
|
69
|
-
|
73
|
+
raise wrapped
|
74
|
+
end
|
70
75
|
|
71
|
-
|
72
|
-
|
76
|
+
def define_use_case_error(use_case, name)
|
77
|
+
unless use_case.const_defined?(name, false)
|
78
|
+
klass = Class.new(StandardError)
|
79
|
+
use_case.const_set(name, klass)
|
73
80
|
end
|
74
|
-
|
75
|
-
raise error
|
81
|
+
use_case.const_get(name)
|
76
82
|
end
|
77
83
|
end
|
78
84
|
end
|
data/lib/caze/version.rb
CHANGED
data/spec/caze_spec.rb
CHANGED
@@ -140,7 +140,11 @@ describe Caze do
|
|
140
140
|
it 'raises with the namespace of the use case' do
|
141
141
|
expect {
|
142
142
|
namespaced_use_case.the_question
|
143
|
-
}.to raise_error
|
143
|
+
}.to raise_error do |error|
|
144
|
+
expect(error).to be_a(DummyUseCaseTest::DummyError)
|
145
|
+
expect(error.cause).to be_a(::DummyError)
|
146
|
+
expect(error.backtrace.first).to match(/in `the_question'/)
|
147
|
+
end
|
144
148
|
end
|
145
149
|
end
|
146
150
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Sampaio
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.6.10
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A DSL to define use cases
|