service_caller 1.0.7 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/service_error.rb +3 -3
- data/lib/service_extend/handler.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4270b7ad52ef57a18ba599c31496415626a298ab824884c416c1b5ff51af75c2
|
4
|
+
data.tar.gz: 627575a83678d20e7ec951b1ac9c4777acdcf91e2ae620e2b99c59ccef5b46c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce323d5562bb0fb08d42121858dfa19c4cf691f5afe27a11c3781ce8475b190ea7b5c4593f71a924908317c2447c2b03b3e6adbcd81471dea41b956970df2ea
|
7
|
+
data.tar.gz: 796dd3b3e3b64fc4e58b76a12778e2436758b62f4305bda9c2896a3278a340d45c12b220f1379933e0dd43d6aebbcb3319cdb6b1c07832af28611c0d6ea7b657
|
data/lib/service_error.rb
CHANGED
@@ -4,7 +4,7 @@ class ServiceError < StandardError
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def generate_from_exception(exception, append_info={})
|
7
|
-
error_obj = {
|
7
|
+
error_obj = {error_message: "#{exception.class.name}: #{exception.message}"}
|
8
8
|
error_obj.merge!(append_info)
|
9
9
|
service_err = new(:internal_error, error_obj)
|
10
10
|
service_err.set_backtrace(exception.backtrace)
|
@@ -14,8 +14,8 @@ class ServiceError < StandardError
|
|
14
14
|
|
15
15
|
def initialize(key, error_obj={})
|
16
16
|
@key = key
|
17
|
-
|
17
|
+
error_message = error_obj.delete(:error_message) || key
|
18
18
|
@error_obj = error_obj
|
19
|
-
super(
|
19
|
+
super(error_message)
|
20
20
|
end
|
21
21
|
end
|
@@ -8,7 +8,7 @@ module ServiceExtend
|
|
8
8
|
rescue ServiceError => e
|
9
9
|
@error = e
|
10
10
|
rescue ActiveRecord::RecordNotFound => e
|
11
|
-
@error = ServiceError.new(:record_not_found,
|
11
|
+
@error = ServiceError.new(:record_not_found, error_message: e.message)
|
12
12
|
@error.set_backtrace(e.backtrace)
|
13
13
|
rescue Exception => e
|
14
14
|
@error = ServiceError.generate_from_exception(e)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_caller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JiaRou Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: basic implement of service object
|
14
14
|
email: laura34963@kdanmobile.com
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
|
-
rubygems_version: 3.0.
|
45
|
+
rubygems_version: 3.0.3
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Ruby Service Basic Class
|