Skip to content

Commit

Permalink
Add error_type and error_location at TrinoQueryError
Browse files Browse the repository at this point in the history
  • Loading branch information
miniway committed Jul 27, 2021
1 parent 95d215d commit e3598c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/trino/client/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/trino/client/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e3598c1

Please sign in to comment.