diff --git a/CHANGELOG.md b/CHANGELOG.md index a0830c2..848c0f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 3.1.0 [unreleased] +### Bug Fixes +1. [#134](https://github.com/influxdata/influxdb-client-ruby/pull/134): Support influxdb v1.8 HTTP error response message. Prior to this change, in case of an HTTP error response (influxDB v1.8) the InfluxError had empty message. + ## 3.0.0 [2023-12-05] ### Bug Fixes diff --git a/lib/influxdb2/client/influx_error.rb b/lib/influxdb2/client/influx_error.rb index aad02a0..dde3873 100644 --- a/lib/influxdb2/client/influx_error.rb +++ b/lib/influxdb2/client/influx_error.rb @@ -32,7 +32,7 @@ def initialize(original = nil, message:, code:, reference:, retry_after:) def self.from_response(response) json = JSON.parse(response.body) - obj = new(message: json['message'] || '', code: response.code, reference: json['code'] || '', + obj = new(message: json['message'] || json['error'] || '', code: response.code, reference: json['code'] || '', retry_after: response['Retry-After'] || '') obj rescue JSON::ParserError