glia-errors 0.14.1 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/glia-errors.gemspec +1 -1
- data/lib/glia/errors/client_errors.rb +30 -0
- data/lib/glia/errors/error_types.rb +5 -0
- data/lib/glia/errors/mapper.rb +1 -1
- data/lib/glia/errors/server_errors.rb +20 -0
- 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: d3c4715a02f44b52b0031084f190a6a589130cf17634c44e762f5340285a1b79
|
4
|
+
data.tar.gz: d208384077179f6eb0a5d80978e156e3d063d2a6410e42c9daabd8134e3b8065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d5a3826b9244860ff36f1c68d42ff198bb83b96e5f0e72e5a2096ad7148e8680ebf98437885894ecfff01beeda5f04246a2b5c371a1904b8490f6d80cb2d79
|
7
|
+
data.tar.gz: 93c6ec3cfad1625c86b76e5a1472e738b8baf20980dcb1a76a627c8e6bda132e1507b94832e8a8c60cea90d3cdf29bb1d223761acf3c36bc4871e8567d625c19
|
data/Gemfile.lock
CHANGED
data/glia-errors.gemspec
CHANGED
@@ -442,6 +442,36 @@ module Glia
|
|
442
442
|
end
|
443
443
|
end
|
444
444
|
|
445
|
+
class FeatureDisabledError < Error
|
446
|
+
def initialize(feature:, message: nil)
|
447
|
+
super(
|
448
|
+
type: FEATURE_DISABLED_ERROR,
|
449
|
+
ref: create_ref(FEATURE_DISABLED_ERROR),
|
450
|
+
message: message || "#{Naming.humanize(feature)} is disabled"
|
451
|
+
)
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
class UnsupportedMediaTypeError < Error
|
456
|
+
def initialize(message: nil)
|
457
|
+
super(
|
458
|
+
type: UNSUPPORTED_MEDIA_TYPE_ERROR,
|
459
|
+
ref: create_ref(UNSUPPORTED_MEDIA_TYPE_ERROR),
|
460
|
+
message: message || 'Unsupported Media Type'
|
461
|
+
)
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
class TooManyRequestsError < Error
|
466
|
+
def initialize(message: nil)
|
467
|
+
super(
|
468
|
+
type: TOO_MANY_REQUESTS_ERROR,
|
469
|
+
ref: create_ref(TOO_MANY_REQUESTS_ERROR),
|
470
|
+
message: message || 'Too Many Requests'
|
471
|
+
)
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
445
475
|
# rubocop:enable Style/Documentation
|
446
476
|
end
|
447
477
|
end
|
@@ -37,9 +37,14 @@ module Glia
|
|
37
37
|
OAUTH_CODE_ALREADY_USED_ERROR = 'oauth_code_already_used_error'
|
38
38
|
APPLE_BUSINESS_CHAT_BUSINESS_USED_BY_OTHER_SITE_ERROR = 'apple_business_chat_business_used_by_other_site_error'
|
39
39
|
ITEMS_OVERLAP_ERROR = 'items_overlap_error'
|
40
|
+
FEATURE_DISABLED_ERROR = 'feature_disabled_error'
|
41
|
+
UNSUPPORTED_MEDIA_TYPE_ERROR = 'unsupported_media_type'
|
42
|
+
TOO_MANY_REQUESTS_ERROR = 'too_many_requests'
|
40
43
|
|
41
44
|
# Server errors
|
42
45
|
INTERNAL_SERVER_ERROR = 'internal_server_error'
|
43
46
|
SERVICE_UNAVAILABLE_ERROR = 'service_unavailable_error'
|
47
|
+
BAD_GATEWAY_ERROR = 'bad_gateway_error'
|
48
|
+
GATEWAY_TIMEOUT_ERROR = 'gateway_timeout_error'
|
44
49
|
end
|
45
50
|
end
|
data/lib/glia/errors/mapper.rb
CHANGED
@@ -120,7 +120,7 @@ module Glia
|
|
120
120
|
'is missing' => MISSING_VALUE_ERROR,
|
121
121
|
# Custom format errors
|
122
122
|
'must be in E.164 format' => INVALID_FORMAT_ERROR,
|
123
|
-
'must be up to 25 symbol string that contains 1-
|
123
|
+
'must be up to 25 symbol string that contains 1-25 digits or hashes and any number of commas' =>
|
124
124
|
INVALID_FORMAT_ERROR,
|
125
125
|
'must be a valid email' => INVALID_FORMAT_ERROR
|
126
126
|
}.freeze
|
@@ -13,6 +13,17 @@ module Glia
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
class BadGatewayError < Error
|
17
|
+
def initialize(message: nil, error_details: nil)
|
18
|
+
super(
|
19
|
+
type: BAD_GATEWAY_ERROR,
|
20
|
+
ref: create_ref(BAD_GATEWAY_ERROR),
|
21
|
+
message: message || 'Bad Gateway',
|
22
|
+
error_details: error_details
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
16
27
|
class ServiceUnavailableError < Error
|
17
28
|
def initialize(message: nil)
|
18
29
|
super(
|
@@ -22,6 +33,15 @@ module Glia
|
|
22
33
|
)
|
23
34
|
end
|
24
35
|
end
|
36
|
+
|
37
|
+
class GatewayTimeoutError < Error
|
38
|
+
def initialize(message: nil)
|
39
|
+
super(
|
40
|
+
type: GATEWAY_TIMEOUT_ERROR, ref: create_ref(GATEWAY_TIMEOUT_ERROR), message: message || 'Gateway Timeout'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
25
45
|
# rubocop:enable Style/Documentation
|
26
46
|
end
|
27
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glia-errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glia TechMovers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|