error_response 0.0.6 → 0.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/error_response.rb +12 -20
- data/lib/error_response.yml +15 -15
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c7b624776222e9871b4743920886d4952f5633c84b45a73afdedaffe5c6cd3
|
4
|
+
data.tar.gz: 78a6d179ef3f1658378e3590e9409d98e1f761358f94d3306ecb58d5dde6a763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7b31c2cee485a6636c5a24aa2136d440fbddbe368121a9d15f742a36a5bb3eb9cf5dc5921acd06e33db32fe30c12f45adfa3d5993f0de23f5ffbf7e1f54252
|
7
|
+
data.tar.gz: a4c5fc1bd33b750df2171c1cb521fd912d6d948e9f1ff7eff4f51cc2131fdf23dd312854ed54318d03358e7ad98dd0c351d7501f99332fdf39b3c9f1e4938e53
|
data/lib/error_response.rb
CHANGED
@@ -1,24 +1,16 @@
|
|
1
|
-
require '
|
2
|
-
class ErrorResponse
|
3
|
-
|
1
|
+
require 'yaml'
|
2
|
+
class ErrorResponse
|
3
|
+
GEM_ROOT = File.expand_path("../..", __FILE__)
|
4
|
+
YAML_PATH = 'lib/error_response.yml'
|
4
5
|
|
5
|
-
def call(key, message=nil)
|
6
|
-
|
6
|
+
def self.call(key, message=nil)
|
7
|
+
string_hash = YAML.load_file(File.join(GEM_ROOT,YAML_PATH))
|
8
|
+
err_json = string_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
error_message: message
|
14
|
-
}
|
15
|
-
}
|
16
|
-
else
|
17
|
-
status = error_data['error_code'][0..2]
|
18
|
-
{
|
19
|
-
status: status,
|
20
|
-
json: error_data
|
21
|
-
}
|
22
|
-
end
|
10
|
+
status = err_json['error_code'] / 1000
|
11
|
+
{
|
12
|
+
'status' => status,
|
13
|
+
'json' => err_json
|
14
|
+
}
|
23
15
|
end
|
24
16
|
end
|
data/lib/error_response.yml
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
wrong_email:
|
2
|
-
error_code:
|
2
|
+
error_code: 400_001
|
3
3
|
error_message: user email not correct
|
4
4
|
wrong_password:
|
5
|
-
error_code:
|
5
|
+
error_code: 400_002
|
6
6
|
error_message: user password not correct
|
7
7
|
verify_receipt_failed:
|
8
|
-
error_code:
|
8
|
+
error_code: 400_003
|
9
9
|
error_message: receipt verify failed
|
10
10
|
resend_confirmation_failed:
|
11
|
-
error_code:
|
11
|
+
error_code: 400_004
|
12
12
|
error_message: confirmation mail resend failed
|
13
13
|
reset_password_failed:
|
14
|
-
error_code:
|
14
|
+
error_code: 400_005
|
15
15
|
error_message: reset password failed
|
16
16
|
upload_video_failed:
|
17
|
-
error_code:
|
17
|
+
error_code: 400_060
|
18
18
|
error_message: upload video failed
|
19
19
|
theme_not_found:
|
20
|
-
error_code:
|
20
|
+
error_code: 400_061
|
21
21
|
error_message: current theme is not found
|
22
22
|
client_not_found:
|
23
|
-
error_code:
|
23
|
+
error_code: 403_001
|
24
24
|
error_message: door_keeper client not found
|
25
25
|
access_token_invalid:
|
26
|
-
error_code:
|
26
|
+
error_code: 403_002
|
27
27
|
error_message: door_keeper access_token invalid
|
28
28
|
user_forbidden:
|
29
|
-
error_code:
|
29
|
+
error_code: 403_003
|
30
30
|
error_message: not enough privilege to access data
|
31
31
|
provider_not_allow:
|
32
|
-
error_code:
|
32
|
+
error_code: 403_004
|
33
33
|
error_message: third-party provider is not allow
|
34
34
|
third_party_missing_email:
|
35
|
-
error_code:
|
35
|
+
error_code: 403_005
|
36
36
|
error_message: third party login is missing email
|
37
37
|
email_existed:
|
38
|
-
error_code:
|
38
|
+
error_code: 409_001
|
39
39
|
error_message: email already existed
|
40
40
|
email_confirmed:
|
41
|
-
error_code:
|
41
|
+
error_code: 409_002
|
42
42
|
error_message: email already confirmed
|
43
43
|
preview_processing:
|
44
|
-
error_code:
|
44
|
+
error_code: 418_001
|
45
45
|
error_message: preview processing, please try it later
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jameslee
|
@@ -9,21 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-08-12 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: settingslogic
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.9
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.9
|
12
|
+
dependencies: []
|
27
13
|
description: use for error_response
|
28
14
|
email: jameslee@kdanmobile.com
|
29
15
|
executables: []
|