glia-errors 0.14.0 → 0.15.0
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/README.md +1 -1
- data/catalog-info.yaml +16 -0
- data/glia-errors.gemspec +1 -1
- data/lib/glia/errors/client_errors.rb +44 -0
- data/lib/glia/errors/error_types.rb +6 -0
- data/lib/glia/errors/mapper.rb +1 -1
- data/lib/glia/errors/server_errors.rb +15 -0
- metadata +3 -3
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae72fe1322934f08cc64c13b2e9ad1d826e327a3efac260e14b2b0da26ad66a5
|
4
|
+
data.tar.gz: 6a9bc75c7e7f552edd739741ed636b048d7994442ba9d3885f5429ee4fc16a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac2f2a450f442b6261bbbe7034ae2e8e4556261195a0fbae20e8cbe0d5a85035957005528c0aad23ab1ccd046d68a453a255ce0619d5a903e10c9a13efacf48e
|
7
|
+
data.tar.gz: 16e41309e3a229581f5bea5f1f25d7419123d4a25ce44ca5605e6a169eeae09175cf638074e44d6753240cceb670df2c926d13e10b72022bd4eb8c9032c0b2f3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/catalog-info.yaml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
apiVersion: backstage.io/v1alpha1
|
3
|
+
kind: Component
|
4
|
+
metadata:
|
5
|
+
name: glia-errors-ruby
|
6
|
+
description: Implements Glia errors in Ruby and provides utilities to easily construct them.
|
7
|
+
annotations:
|
8
|
+
github.com/project-slug: salemove/glia-errors
|
9
|
+
github.com/team-slug: salemove/tm-movers
|
10
|
+
snyk.io/org-name: glia-movers
|
11
|
+
tags:
|
12
|
+
- ruby
|
13
|
+
spec:
|
14
|
+
type: library
|
15
|
+
lifecycle: production
|
16
|
+
owner: tm-messenger
|
data/glia-errors.gemspec
CHANGED
@@ -207,6 +207,20 @@ module Glia
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
+
class ResourceLockedError < Error
|
211
|
+
def initialize(resource:, locked_by: nil, message: nil)
|
212
|
+
Naming.assert_snake_case(resource)
|
213
|
+
|
214
|
+
is_locked_by = locked_by.nil? ? '' : "Locked by: #{locked_by}"
|
215
|
+
super(
|
216
|
+
type: RESOURCE_LOCKED,
|
217
|
+
ref: create_ref(RESOURCE_LOCKED),
|
218
|
+
message: message || "#{Naming.humanize(resource)} is locked. #{is_locked_by}",
|
219
|
+
error_details: { resource: resource, locked_by: locked_by }
|
220
|
+
)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
210
224
|
class ResourceAlreadyExistsError < Error
|
211
225
|
def initialize(resource:, message: nil)
|
212
226
|
Naming.assert_snake_case(resource)
|
@@ -428,6 +442,36 @@ module Glia
|
|
428
442
|
end
|
429
443
|
end
|
430
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
|
+
|
431
475
|
# rubocop:enable Style/Documentation
|
432
476
|
end
|
433
477
|
end
|
@@ -16,6 +16,7 @@ module Glia
|
|
16
16
|
REMAINING_ASSOCIATION_ERROR = 'remaining_association_error'
|
17
17
|
RESOURCE_LIMIT_EXCEEDED_ERROR = 'resource_limit_exceeded_error'
|
18
18
|
RESOURCE_MINIMUM_NOT_REACHED = 'resource_minimum_not_reached'
|
19
|
+
RESOURCE_LOCKED = 'resource_locked'
|
19
20
|
RESOURCE_ALREADY_EXISTS_ERROR = 'resource_already_exists_error'
|
20
21
|
INVALID_RESOURCE_STATE_ERROR = 'invalid_resource_state_error'
|
21
22
|
AUTHORIZATION_ERROR = 'authorization_error'
|
@@ -36,9 +37,14 @@ module Glia
|
|
36
37
|
OAUTH_CODE_ALREADY_USED_ERROR = 'oauth_code_already_used_error'
|
37
38
|
APPLE_BUSINESS_CHAT_BUSINESS_USED_BY_OTHER_SITE_ERROR = 'apple_business_chat_business_used_by_other_site_error'
|
38
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'
|
39
43
|
|
40
44
|
# Server errors
|
41
45
|
INTERNAL_SERVER_ERROR = 'internal_server_error'
|
42
46
|
SERVICE_UNAVAILABLE_ERROR = 'service_unavailable_error'
|
47
|
+
BAD_GATEWAY_ERROR = 'bad_gateway_error'
|
48
|
+
GATEWAY_TIMEOUT_ERROR = 'gateway_timeout_error'
|
43
49
|
end
|
44
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,12 @@ module Glia
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
class BadGatewayError < Error
|
17
|
+
def initialize(message: nil)
|
18
|
+
super(type: BAD_GATEWAY_ERROR, ref: create_ref(BAD_GATEWAY_ERROR), message: message || 'Bad Gateway')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
16
22
|
class ServiceUnavailableError < Error
|
17
23
|
def initialize(message: nil)
|
18
24
|
super(
|
@@ -22,6 +28,15 @@ module Glia
|
|
22
28
|
)
|
23
29
|
end
|
24
30
|
end
|
31
|
+
|
32
|
+
class GatewayTimeoutError < Error
|
33
|
+
def initialize(message: nil)
|
34
|
+
super(
|
35
|
+
type: GATEWAY_TIMEOUT_ERROR, ref: create_ref(GATEWAY_TIMEOUT_ERROR), message: message || 'Gateway Timeout'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
25
40
|
# rubocop:enable Style/Documentation
|
26
41
|
end
|
27
42
|
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.0
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|
@@ -23,11 +23,11 @@ files:
|
|
23
23
|
- ".rspec"
|
24
24
|
- ".rubocop.yml"
|
25
25
|
- ".ruby-version"
|
26
|
-
- ".travis.yml"
|
27
26
|
- Gemfile
|
28
27
|
- Gemfile.lock
|
29
28
|
- README.md
|
30
29
|
- Rakefile
|
30
|
+
- catalog-info.yaml
|
31
31
|
- glia-errors.gemspec
|
32
32
|
- lib/glia/errors.rb
|
33
33
|
- lib/glia/errors/client_errors.rb
|
data/.travis.yml
DELETED