Exception: QuoteSql::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- QuoteSql::Error
- Defined in:
- lib/quote_sql/error.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #columns ⇒ Object
-
#initialize(quote_sql, errors) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #original ⇒ Object
- #quotes ⇒ Object
- #sql ⇒ Object
- #tables ⇒ Object
Constructor Details
#initialize(quote_sql, errors) ⇒ Error
Returns a new instance of Error.
3 4 5 6 |
# File 'lib/quote_sql/error.rb', line 3 def initialize(quote_sql, errors) @object = quote_sql @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/quote_sql/error.rb', line 8 def errors @errors end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
8 9 10 |
# File 'lib/quote_sql/error.rb', line 8 def object @object end |
Instance Method Details
#columns ⇒ Object
22 23 24 |
# File 'lib/quote_sql/error.rb', line 22 def columns @object.columns.inspect end |
#message ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/quote_sql/error.rb', line 30 def errors = @object.errors.map do |quote, error| error => {exc:, backtrace:, **transformations} "#{quote}: #{exc.class} #{exc.} #{transformations.inspect}\n#{backtrace.join("\n")}" end <<~ERROR Original: #{original} Tables: Quotes: #{quotes} Processed: #{sql} #{errors.join("\n\n")} #{'*' * 40} ERROR end |
#original ⇒ Object
10 11 12 |
# File 'lib/quote_sql/error.rb', line 10 def original @object.original.dsql end |
#quotes ⇒ Object
26 27 28 |
# File 'lib/quote_sql/error.rb', line 26 def quotes @object.quotes.inspect end |
#sql ⇒ Object
14 15 16 |
# File 'lib/quote_sql/error.rb', line 14 def sql @object.sql.dsql end |
#tables ⇒ Object
18 19 20 |
# File 'lib/quote_sql/error.rb', line 18 def tables @object.tables.inspect end |