class Fluent::BigQuery::Error

@abstract

Constants

RETRYABLE_ERROR_REASON
RETRYABLE_INSERT_ERRORS_REASON
RETRYABLE_STATUS_CODE

Attributes

origin[R]

Public Class Methods

inherited(subclass) click to toggle source

Guard for instantiation

# File lib/fluent/plugin/bigquery/errors.rb, line 35
def inherited(subclass)
  subclass.class_eval do
    class << self
      public :new
    end
  end
end
new(message, origin = nil) click to toggle source
Calls superclass method
# File lib/fluent/plugin/bigquery/errors.rb, line 46
def initialize(message, origin = nil)
  @origin = origin
  super(message || origin.message)
end
retryable_error?(e) click to toggle source

@param e [Google::Apis::Error]

# File lib/fluent/plugin/bigquery/errors.rb, line 21
def retryable_error?(e)
  e.is_a?(Google::Apis::ServerError) && RETRYABLE_STATUS_CODE.include?(e.status_code)
end
retryable_error_reason?(reason) click to toggle source
# File lib/fluent/plugin/bigquery/errors.rb, line 25
def retryable_error_reason?(reason)
  RETRYABLE_ERROR_REASON.include?(reason)
end
retryable_insert_errors_reason?(reason) click to toggle source
# File lib/fluent/plugin/bigquery/errors.rb, line 29
def retryable_insert_errors_reason?(reason)
  RETRYABLE_INSERT_ERRORS_REASON.include?(reason)
end
wrap(e, message = nil) click to toggle source

@param e [Google::Apis::Error] @param message [String]

# File lib/fluent/plugin/bigquery/errors.rb, line 12
def wrap(e, message = nil)
  if retryable_error?(e)
    RetryableError.new(message, e)
  else
    UnRetryableError.new(message, e)
  end
end

Public Instance Methods

body() click to toggle source
# File lib/fluent/plugin/bigquery/errors.rb, line 67
def body
  @origin && @origin.respond_to?(:body) ? @origin.body : nil
end
method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/fluent/plugin/bigquery/errors.rb, line 51
def method_missing(name, *args)
  if @origin
    @origin.send(name, *args)
  else
    super
  end
end
reason() click to toggle source
# File lib/fluent/plugin/bigquery/errors.rb, line 59
def reason
  @origin && @origin.respond_to?(:reason) ? @origin.reason : nil
end
retryable?() click to toggle source
# File lib/fluent/plugin/bigquery/errors.rb, line 71
def retryable?
  false
end
status_code() click to toggle source
# File lib/fluent/plugin/bigquery/errors.rb, line 63
def status_code
  @origin && @origin.respond_to?(:status_code) ? @origin.status_code : nil
end