From e3598c1ee26b9a2d5455a46709f7ae461c6539cf Mon Sep 17 00:00:00 2001 From: "Min(Dongmin Yu)" Date: Tue, 27 Jul 2021 09:54:38 +0900 Subject: [PATCH] Add error_type and error_location at TrinoQueryError --- lib/trino/client/errors.rb | 6 ++++-- lib/trino/client/query.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/trino/client/errors.rb b/lib/trino/client/errors.rb index e4bd4721..4ded538f 100644 --- a/lib/trino/client/errors.rb +++ b/lib/trino/client/errors.rb @@ -30,15 +30,17 @@ class TrinoClientError < TrinoError end class TrinoQueryError < TrinoError - def initialize(message, query_id, error_code, error_name, failure_info) + def initialize(message, query_id, error_code, error_name, error_type, error_location, failure_info) super(message) @query_id = query_id @error_code = error_code @error_name = error_name + @error_type = error_type + @error_location = error_location @failure_info = failure_info end - attr_reader :error_code, :error_name, :failure_info + attr_reader :error_code, :error_name, :error_type, :error_location, :failure_info end class TrinoQueryTimeoutError < TrinoError diff --git a/lib/trino/client/query.rb b/lib/trino/client/query.rb index 8ee3835c..226ca941 100644 --- a/lib/trino/client/query.rb +++ b/lib/trino/client/query.rb @@ -136,7 +136,7 @@ def raise_if_failed elsif @api.query_failed? results = @api.current_results error = results.error - raise TrinoQueryError.new("Query #{results.id} failed: #{error.message}", results.id, error.error_code, error.error_name, error.failure_info) + raise TrinoQueryError.new("Query #{results.id} failed: #{error.message}", results.id, error.error_code, error.error_name, error.error_type, error.error_location, error.failure_info) end end end