lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-0.5.0.beta1 vs lib/fluent/plugin/bigquery/writer.rb in fluent-plugin-bigquery-0.5.0.beta2

- old
+ new

@@ -111,12 +111,18 @@ end rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e @client = nil reason = e.respond_to?(:reason) ? e.reason : nil - log.error "tabledata.insertAll API", project_id: project, dataset: dataset, table: table_id, code: e.status_code, message: e.message, reason: reason + error_data = { project_id: project, dataset: dataset, table: table_id, code: e.status_code, message: e.message, reason: reason } + wrapped = Fluent::BigQuery::Error.wrap(e) + if wrapped.retryable? + log.warn "tabledata.insertAll API", error_data + else + log.error "tabledata.insertAll API", error_data + end - raise Fluent::BigQuery::Error.wrap(e) + raise wrapped end def create_load_job(chunk_id, project, dataset, table_id, upload_source, fields) configuration = { configuration: {