glia-errors 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c7f5990ad3700b39cf8e730592d7a0e1bb41968015c54c648f341e329679852
4
- data.tar.gz: 56963475888904d6d252deb42667536caeb1a7ff96c7bbb35d5204395f60723d
3
+ metadata.gz: f6960566975ff5446a08dfc290bf2b1ebe1d3543df49e79ffb2ec24ad8f87763
4
+ data.tar.gz: 06f24196271555ebc4f5e2ac217399c8ad161fb0f6717cbe990fd8b7cc607da7
5
5
  SHA512:
6
- metadata.gz: 7a09bd918e4be8fb7463523004703cf8d94e1a709f70f545f3b8f1d51384c5ba9a2be31c0a0b633042b9eec610003251b1fceb122d266c667ff18f4789487ef1
7
- data.tar.gz: 4749bb8358fc6a1dc3f8940ae9ef5424cfdb65bef2361a529ea591890e86a8ec43a1b33207be110e7404c0ae270bd0cb197bfe11d744583ef698cce02cbbc3fe
6
+ metadata.gz: bf8a1d4cc12a450424668ddf201f7cdf20293e8cca5c4269f6a405bbd91718b40e2e6011537cd39643728510fd75b0e51e05f84dcebf85ea5bcadb3a637f6ce2
7
+ data.tar.gz: 9ae41cf5a5f711c9a795ca7aeb6e67bc31c57c2926e05bd898b3645c4e4be6acfd1e94eafbbc687a6c0bb8bda512e0cbaa77a6c01f4c6a1b360149f8effcb231
data/glia-errors.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'glia-errors'
8
- spec.version = '0.8.0'
8
+ spec.version = '0.9.0'
9
9
  spec.authors = ['Glia TechMovers']
10
10
  spec.email = ['techmovers@glia.com']
11
11
 
@@ -115,11 +115,16 @@ module Glia
115
115
  end
116
116
 
117
117
  class UnknownError < Error
118
- def initialize(field:, message: nil)
118
+ def initialize(field: nil, message: nil)
119
119
  super(
120
120
  type: UNKNOWN_ERROR,
121
121
  ref: create_ref(UNKNOWN_ERROR),
122
- message: message || "#{Naming.humanize(field)} validation failed with unknown error"
122
+ message:
123
+ if field
124
+ message || "#{Naming.humanize(field)} validation failed with unknown error"
125
+ else
126
+ message || 'Failed with unknown error'
127
+ end
123
128
  )
124
129
  end
125
130
  end
@@ -247,6 +252,76 @@ module Glia
247
252
  )
248
253
  end
249
254
  end
255
+
256
+ class CarrierError < Error
257
+ def initialize(message: nil)
258
+ super(
259
+ type: CARRIER_ERROR,
260
+ ref: create_ref(CARRIER_ERROR),
261
+ message: message || 'Downstream carrier issue occurred'
262
+ )
263
+ end
264
+ end
265
+
266
+ class GeographicPermissionError < Error
267
+ def initialize(message: nil)
268
+ super(
269
+ type: GEOGRAPHIC_PERMISSION_ERROR,
270
+ ref: create_ref(GEOGRAPHIC_PERMISSION_ERROR),
271
+ message: message || 'Insufficient permissions for geographic region'
272
+ )
273
+ end
274
+ end
275
+
276
+ class MessageBlockedError < Error
277
+ def initialize(message: nil)
278
+ super(
279
+ type: MESSAGE_BLOCKED_ERROR,
280
+ ref: create_ref(MESSAGE_BLOCKED_ERROR),
281
+ message: message || 'Message blocked or filtered'
282
+ )
283
+ end
284
+ end
285
+
286
+ class TelephonyProviderRateLimitExceededError < Error
287
+ def initialize(message: nil)
288
+ super(
289
+ type: TELEPHONY_PROVIDER_RATE_LIMIT_EXCEEDED_ERROR,
290
+ ref: create_ref(TELEPHONY_PROVIDER_RATE_LIMIT_EXCEEDED_ERROR),
291
+ message: message || 'Telephony provider message send rate limit exceeded'
292
+ )
293
+ end
294
+ end
295
+
296
+ class TelephonyProviderQueueLimitExceededError < Error
297
+ def initialize(message: nil)
298
+ super(
299
+ type: TELEPHONY_PROVIDER_QUEUE_LIMIT_EXCEEDED_ERROR,
300
+ ref: create_ref(TELEPHONY_PROVIDER_QUEUE_LIMIT_EXCEEDED_ERROR),
301
+ message: message || 'Telephony provider message send queue is full'
302
+ )
303
+ end
304
+ end
305
+
306
+ class TwilioMessagingServiceConfigurationError < Error
307
+ def initialize(message: nil)
308
+ super(
309
+ type: TWILIO_MESSAGING_SERVICE_CONFIGURATION_ERROR,
310
+ ref: create_ref(TWILIO_MESSAGING_SERVICE_CONFIGURATION_ERROR),
311
+ message: message || 'Invalid Twilio Messaging Service configuration'
312
+ )
313
+ end
314
+ end
315
+
316
+ class UnreachableDestinationError < Error
317
+ def initialize(message: nil)
318
+ super(
319
+ type: UNREACHABLE_DESTINATION_ERROR,
320
+ ref: create_ref(UNREACHABLE_DESTINATION_ERROR),
321
+ message: message || 'Destination is unreachable'
322
+ )
323
+ end
324
+ end
250
325
  # rubocop:enable Style/Documentation
251
326
  end
252
327
  end
@@ -21,6 +21,13 @@ module Glia
21
21
  RECIPIENT_OPTED_OUT_ERROR = 'recipient_opted_out_error'
22
22
  ROUTE_NOT_FOUND_ERROR = 'route_not_found_error'
23
23
  MALFORMED_INPUT_ERROR = 'malformed_input_error'
24
+ CARRIER_ERROR = 'carrier_error'
25
+ GEOGRAPHIC_PERMISSION_ERROR = 'geographic_permission_error'
26
+ MESSAGE_BLOCKED_ERROR = 'message_blocked_error'
27
+ TELEPHONY_PROVIDER_RATE_LIMIT_EXCEEDED_ERROR = 'telephony_provider_rate_limit_exceeded_error'
28
+ TELEPHONY_PROVIDER_QUEUE_LIMIT_EXCEEDED_ERROR = 'telephony_provider_queue_limit_exceeded_error'
29
+ TWILIO_MESSAGING_SERVICE_CONFIGURATION_ERROR = 'twilio_messaging_service_configuration_error'
30
+ UNREACHABLE_DESTINATION_ERROR = 'unreachable_destination_error'
24
31
 
25
32
  # Server errors
26
33
  INTERNAL_SERVER_ERROR = 'internal_server_error'
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.8.0
4
+ version: 0.9.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: 2021-03-12 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email: