light-service 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dbadd45523f6245d302d195937328fe1819f9b7
4
- data.tar.gz: fa3836bd03de541b3d24cc38e9a13800b3c35381
3
+ metadata.gz: 43b8226d18386ca933714af81639598fdff2332d
4
+ data.tar.gz: e7112eea09148ee8f06412e7e2f61cea18375d05
5
5
  SHA512:
6
- metadata.gz: c8356b2a0cd6a0ea403f470352c6c686473340752ac6d35f7bd87893e06167032b51177c4ca4d261da819e4609106034838fbbd0a56d5ec5bddaf8731639959c
7
- data.tar.gz: 23696cd73809aaa2ddd2e76c5d2f3d3fb3b2e34640210c830b2404b4132fad2badc816531e54322a3b7d673b1767586e10d0f331ef7d1e0a2bc218ef1c1c3b2a
6
+ metadata.gz: 6c772140e17955b44a37b923ed4f09a110e5d21da479e2ba44c8a6b0f81b8f647808c722932b56b407bbee781bd57c33981cb36b403f24ee29f746e184410ad1
7
+ data.tar.gz: 741bf14615577c1d9fe518e5835e3a4a9bde8879810ce9765983db65195afbd5d63e598fe07335bbe47158a9779d9fe23e0f890560dc19bffe5e3bba3ba84784
data/README.md CHANGED
@@ -202,8 +202,8 @@ Take a look at [this spec](spec/action_expects_and_promises_spec.rb) to see the
202
202
 
203
203
  ## Error Codes
204
204
 
205
- You can do a more structured error handling by using error codes in the context.
206
- If something goes wrong in your actions, you can fail the process by setting the context to failure:
205
+ You can add some more structure to your error handling by taking advantage of error codes in the context.
206
+ Normally, when something goes wrong in your actions, you fail the process by setting the context to failure:
207
207
 
208
208
  ```ruby
209
209
  class FooAction
@@ -216,8 +216,8 @@ end
216
216
  ```
217
217
 
218
218
  However, you might need to handle the errors coming from your action pipeline differently.
219
- Using an error code can help you check what type of expected error occurred from the organizer
220
- or action invocation point.
219
+ Using an error code can help you check what type of expected error occurred in the organizer
220
+ or in the actions.
221
221
 
222
222
  ```ruby
223
223
  class FooAction
@@ -273,6 +273,8 @@ For further examples, please visit the project's [Wiki](https://github.com/adomo
273
273
  Huge thanks to the [contributors](https://github.com/adomokos/light-service/graphs/contributors)!
274
274
 
275
275
  ## Release Notes
276
+ ### 0.3.2
277
+ * Fixing documentation and using separate arguments instead of a hash when setting the context to failure
276
278
  ### 0.3.1
277
279
  * Adding [error codes](https://github.com/adomokos/light-service#error-codes) to the context
278
280
 
@@ -60,13 +60,9 @@ module LightService
60
60
  fail!(message)
61
61
  end
62
62
 
63
- def fail!(options=nil)
64
- if options.is_a? Hash
65
- @message = options[:message]
66
- @error_code = options[:error_code]
67
- else
68
- @message = options
69
- end
63
+ def fail!(message=nil, error_code=nil)
64
+ @message = message
65
+ @error_code = error_code
70
66
  @outcome = ::LightService::Outcomes::FAILURE
71
67
  end
72
68
 
@@ -1,3 +1,3 @@
1
1
  module LightService
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -84,17 +84,19 @@ module LightService
84
84
 
85
85
  it "can be pushed into a FAILURE state with a message in an options hash" do
86
86
  context = Context.make
87
- context.fail!(:message => "a sad end")
87
+ context.fail!("a sad end")
88
88
 
89
89
  expect(context).to be_failure
90
+ expect(context.message).to eq("a sad end")
90
91
  expect(context.error_code).to be_nil
91
92
  end
92
93
 
93
94
  it "can be pushed into a FAILURE state with an error code in an options hash" do
94
95
  context = Context.make
95
- context.fail!(:error_code => 10005)
96
+ context.fail!("a sad end", 10005)
96
97
 
97
98
  expect(context).to be_failure
99
+ expect(context.message).to eq("a sad end")
98
100
  expect(context.error_code).to eq(10005)
99
101
  end
100
102
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: light-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Attila Domokos