civil_service 1.0.0 → 2.0.0
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/CHANGELOG.md +19 -0
- data/Gemfile.lock +8 -8
- data/README.md +1 -1
- data/lib/civil_service/result.rb +1 -1
- data/lib/civil_service/service.rb +6 -1
- data/lib/civil_service/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0155a0d0cbcf7c649725deedc1eb51e64ebe4f6a5f77ea4fbb6022768598afd
|
4
|
+
data.tar.gz: 82f50992961ad30130760307434340c180a459052fe4fa04c1bd295472be8a19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec1adf3b57089d4849ca5ce70b2ed8b9938ee03aabd55b3e0952ee0d3cb0734e87bac765794b023c83b80276312c1e754a3ce517a97af9eaed80ac1f94e242b0
|
7
|
+
data.tar.gz: ff3622cb3f407734e8adfe0b4f844d9db437f72a642b17669920339027bdd62cf1a0aaf27d11fa4e35bcfdb2c878572579f1066cb5ec25567a6d0253dc6f32ab
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Version 2.0.0 - June 26, 2019
|
2
|
+
|
3
|
+
* BREAKING CHANGE: The behavior of `CivilService::Service#call` has changed when exceptions are
|
4
|
+
raised inside the service. The `call` method will now catch the exception and return a failing
|
5
|
+
result object, with the exception message as an error on `:base`.
|
6
|
+
|
7
|
+
The behavior of `call!` has not changed: a failing result will be raised as a
|
8
|
+
`CivilService::ServiceFailure` exception, and an exception thrown inside the service will not be
|
9
|
+
caught (and therefore will be raised to the caller).
|
10
|
+
|
11
|
+
The idea of this change is that the behaviors of `call` and `call!` are now predictable: `call`
|
12
|
+
will (almost) never raise an exception, whereas `call!` can raise an exception.
|
13
|
+
|
14
|
+
The exception to this rule (pun intended, always intend your puns) is that `call` will not catch
|
15
|
+
exceptions that don't inherit from `StandardError`, such as `SystemExit`. See
|
16
|
+
[Honeybadger's explanation](https://www.honeybadger.io/blog/a-beginner-s-guide-to-exceptions-in-ruby/)
|
17
|
+
of why this is a good idea.
|
18
|
+
* `CivilService::Result` now has an additional attribute called `exception`, which can be used to
|
19
|
+
retrieve an exception thrown inside a `call` method.
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
civil_service (
|
4
|
+
civil_service (2.0.0)
|
5
5
|
activemodel (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (5.
|
11
|
-
activesupport (= 5.
|
12
|
-
activesupport (5.
|
10
|
+
activemodel (5.2.3)
|
11
|
+
activesupport (= 5.2.3)
|
12
|
+
activesupport (5.2.3)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (
|
14
|
+
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
-
concurrent-ruby (1.
|
18
|
-
i18n (
|
17
|
+
concurrent-ruby (1.1.5)
|
18
|
+
i18n (1.6.0)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
20
|
minitest (5.11.3)
|
21
21
|
rake (10.5.0)
|
@@ -33,4 +33,4 @@ DEPENDENCIES
|
|
33
33
|
rake (~> 10.0)
|
34
34
|
|
35
35
|
BUNDLED WITH
|
36
|
-
1.
|
36
|
+
1.17.2
|
data/README.md
CHANGED
data/lib/civil_service/result.rb
CHANGED
@@ -17,7 +17,12 @@ class CivilService::Service
|
|
17
17
|
return failure(errors) unless valid?
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
begin
|
21
|
+
inner_call
|
22
|
+
rescue StandardError => exception
|
23
|
+
errors.add :base, exception.message
|
24
|
+
failure(errors, exception: exception)
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
def call!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: civil_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Budin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -77,6 +77,7 @@ extra_rdoc_files: []
|
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
79
|
- ".travis.yml"
|
80
|
+
- CHANGELOG.md
|
80
81
|
- CODE_OF_CONDUCT.md
|
81
82
|
- Gemfile
|
82
83
|
- Gemfile.lock
|
@@ -109,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
requirements: []
|
112
|
-
|
113
|
-
rubygems_version: 2.7.3
|
113
|
+
rubygems_version: 3.0.3
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: A tiny service object framework for Rails apps
|