Exception: SQLite3::Exception
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
AbortException, AuthorizationException, BusyException, CantOpenException, ConstraintException, CorruptException, EmptyException, FormatException, FullException, IOException, InternalException, InterruptException, LockedException, MemoryException, MismatchException, MisuseException, NotADatabaseException, NotFoundException, PermissionException, ProtocolException, RangeException, ReadOnlyException, SQLException, SchemaChangedException, TooBigException, UnsupportedException
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
StandardError
|
|
Instance Chain:
self,
StandardError
|
|
Inherits: |
StandardError
|
Defined in: | lib/sqlite3/errors.rb |
Instance Attribute Summary
-
#code
readonly
A convenience for accessing the error code for this exception.
-
#sql
readonly
If the error is associated with a SQL query, this is the query.
-
#sql_offset
readonly
If the error is associated with a particular offset in a SQL query, this is the non-negative offset.
Instance Method Summary
- #message
- #sql_error private
Instance Attribute Details
#code (readonly)
A convenience for accessing the error code for this exception.
# File 'lib/sqlite3/errors.rb', line 6
attr_reader :code
#sql (readonly)
If the error is associated with a SQL query, this is the query
# File 'lib/sqlite3/errors.rb', line 9
attr_reader :sql
#sql_offset (readonly)
If the error is associated with a particular offset in a SQL query, this is the non-negative offset. If the offset is not available, this will be -1.
# File 'lib/sqlite3/errors.rb', line 13
attr_reader :sql_offset
Instance Method Details
#message
[ GitHub ]# File 'lib/sqlite3/errors.rb', line 15
def [super, sql_error].compact.join(":\n") end
#sql_error (private)
[ GitHub ]# File 'lib/sqlite3/errors.rb', line 19
private def sql_error return nil unless @sql return @sql.chomp unless @sql_offset >= 0 offset = @sql_offset sql.lines.flat_map do |line| if offset >= 0 && line.length > offset blanks = " " * offset offset = -1 [line.chomp, blanks + "^"] else offset -= line.length if offset line.chomp end end.join("\n") end