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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/error_response.rb +6 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc196d31f6efba6daf505398631854613de7c94c9b6b4e3e365bcc44519d0b31
4
- data.tar.gz: 5b0ed90c4275256fd5fca3b26463826b8a8f1f9df83bf62b604cab923930e9ed
3
+ metadata.gz: c2bffc5e8ad94e430ac4e12de4670f3de41f3ee29d1912ff74b20a228869da54
4
+ data.tar.gz: ac9b4d2a3345caf6651e745c6f4deab4476a8ceb5fc234fe04e080f8d5173afe
5
5
  SHA512:
6
- metadata.gz: 14ac71c26ddec3ec948131b0e0f2c5e1d6fde6775abde8513d21d621148a0015012207eb5c5f9fdace369ae75ca74d9b6d6c639e368f8b1a1f8ee3033abf6294
7
- data.tar.gz: 3d012a284a580986cadfcf9c103779642eca3cb4b6a734b4c548bccaade20a8f5e9acfe1b1a426c4117120dc14c4b5e47e059918c46a00ff1a90c5d6cd0eee3c
6
+ metadata.gz: aa3c405b6dd31b1eb09fb59d7a72296b9f85144de3da26c3cce84b0a0d6a8879fa44318dfe841fc00baf2e89efc3d37906f204a870a35248bc49a717b1ec4f59
7
+ data.tar.gz: 61d25463d13501d958c31193c51a943c6b6fae3b2f5953c7091e6e1f0a50d5a0a67a233583bfb85f2dd7018a39f522d61fe0261c8da739b3b199afa2b34b01fc
@@ -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] || {'error_code' => 500000, 'error_message' => message}
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.3
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.6
39
+ rubygems_version: 3.0.1
40
40
  signing_key:
41
41
  specification_version: 4
42
42
  summary: A tool for API error response