Exception: Fluent::BigQuery::Error
Abstract
- Inherits:
-
StandardError
- Object
- StandardError
- Fluent::BigQuery::Error
show all
- Defined in:
- lib/fluent/plugin/bigquery/errors.rb
Overview
Constant Summary
collapse
- RETRYABLE_ERROR_REASON =
%w(backendError internalError rateLimitExceeded tableUnavailable).freeze
- RETRYABLE_INSERT_ERRORS_REASON =
%w(timeout backendError internalError rateLimitExceeded).freeze
- RETRYABLE_STATUS_CODE =
[500, 502, 503, 504]
- REGION_NOT_WRITABLE_MESSAGE =
-"is not writable in the region"
- SSL_UNEXPECTED_EOF_MESSAGE =
-"SSL_read: unexpected eof while reading"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(message, origin = nil) ⇒ Error
Returns a new instance of Error.
60
61
62
63
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 60
def initialize(message, origin = nil)
@origin = origin
super(message || origin.message)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 65
def method_missing(name, *args)
if @origin
@origin.send(name, *args)
else
super
end
end
|
Instance Attribute Details
#origin ⇒ Object
Returns the value of attribute origin.
58
59
60
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 58
def origin
@origin
end
|
Class Method Details
.inherited(subclass) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 49
def inherited(subclass)
subclass.class_eval do
class << self
public :new
end
end
end
|
.retryable_error?(e) ⇒ Boolean
23
24
25
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 23
def retryable_error?(e)
retryable_server_error?(e) || retryable_region_not_writable?(e) || retryable_ssl_unexpected_eof?(e)
end
|
.retryable_error_reason?(reason) ⇒ Boolean
31
32
33
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 31
def retryable_error_reason?(reason)
RETRYABLE_ERROR_REASON.include?(reason)
end
|
.retryable_insert_errors_reason?(reason) ⇒ Boolean
35
36
37
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 35
def retryable_insert_errors_reason?(reason)
RETRYABLE_INSERT_ERRORS_REASON.include?(reason)
end
|
.retryable_region_not_writable?(e) ⇒ Boolean
39
40
41
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 39
def retryable_region_not_writable?(e)
e.is_a?(Google::Apis::ClientError) && e.status_code == 400 && e.message.include?(REGION_NOT_WRITABLE_MESSAGE)
end
|
.retryable_server_error?(e) ⇒ Boolean
27
28
29
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 27
def retryable_server_error?(e)
e.is_a?(Google::Apis::ServerError) && RETRYABLE_STATUS_CODE.include?(e.status_code)
end
|
.retryable_ssl_unexpected_eof?(e) ⇒ Boolean
43
44
45
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 43
def retryable_ssl_unexpected_eof?(e)
e.message.include?(SSL_UNEXPECTED_EOF_MESSAGE)
end
|
.wrap(e, message = nil) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 14
def wrap(e, message = nil)
if retryable_error?(e)
RetryableError.new(message, e)
else
UnRetryableError.new(message, e)
end
end
|
Instance Method Details
#body ⇒ Object
81
82
83
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 81
def body
@origin && @origin.respond_to?(:body) ? @origin.body : nil
end
|
#reason ⇒ Object
73
74
75
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 73
def reason
@origin && @origin.respond_to?(:reason) ? @origin.reason : nil
end
|
#retryable? ⇒ Boolean
85
86
87
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 85
def retryable?
false
end
|
#status_code ⇒ Object
77
78
79
|
# File 'lib/fluent/plugin/bigquery/errors.rb', line 77
def status_code
@origin && @origin.respond_to?(:status_code) ? @origin.status_code : nil
end
|