error_response 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/error_response.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2bffc5e8ad94e430ac4e12de4670f3de41f3ee29d1912ff74b20a228869da54
|
4
|
+
data.tar.gz: ac9b4d2a3345caf6651e745c6f4deab4476a8ceb5fc234fe04e080f8d5173afe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa3c405b6dd31b1eb09fb59d7a72296b9f85144de3da26c3cce84b0a0d6a8879fa44318dfe841fc00baf2e89efc3d37906f204a870a35248bc49a717b1ec4f59
|
7
|
+
data.tar.gz: 61d25463d13501d958c31193c51a943c6b6fae3b2f5953c7091e6e1f0a50d5a0a67a233583bfb85f2dd7018a39f522d61fe0261c8da739b3b199afa2b34b01fc
|
data/lib/error_response.rb
CHANGED
@@ -3,7 +3,12 @@ class ErrorResponse
|
|
3
3
|
YAML_PATH = 'config/error_response.yml'
|
4
4
|
|
5
5
|
def self.to_api(key, message=nil)
|
6
|
-
err_json = yaml_hash[key.to_s]
|
6
|
+
err_json = yaml_hash[key.to_s]
|
7
|
+
if err_json.nil?
|
8
|
+
err_json = {'error_code' => 500000, 'error_message' => message}
|
9
|
+
elsif !message.nil?
|
10
|
+
err_json['error_message'] += ": #{message}"
|
11
|
+
end
|
7
12
|
|
8
13
|
status = err_json['error_code'] / 1000
|
9
14
|
{
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: error_response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jameslee
|
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|
39
|
-
rubygems_version: 3.0.
|
39
|
+
rubygems_version: 3.0.1
|
40
40
|
signing_key:
|
41
41
|
specification_version: 4
|
42
42
|
summary: A tool for API error response
|