class DuckDB::Error
The exception raised by ruby-duckdb.
Public Class Methods
Source
# File lib/duckdb/error.rb, line 8 def initialize(message = nil, error_type_id = nil) super(message) @error_type_id = error_type_id end
error_type_id is the raw DuckDB error type id, set by the C extension when a query result fails; it defaults to nil for all other errors.
Calls superclass method
Public Instance Methods
Source
# File lib/duckdb/error.rb, line 22 def error_type @error_type_id && Converter::IntToSym.error_type_to_sym(@error_type_id) end
Returns the DuckDB error category as a Symbol (e.g. :constraint, :catalog, :parser), or nil when the error did not originate from a DuckDB query result (e.g. internal binding failures).
begin con.query('INSERT INTO t VALUES (1)') # duplicate primary key rescue DuckDB::Error => e e.error_type # => :constraint end