diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-12-17 17:27:57 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-12-17 17:27:57 -0200 |
commit | 746e3ad6ef3da9514aa1b1f172af4e5db6dc9797 (patch) | |
tree | ddaa5e04d4e05c673094b959d18caae34d7c6e51 /lib | |
parent | 9ca32a67bbcb24f13303718ca1c63b10fcb761ab (diff) | |
parent | 145f32ad8516f9654bdc469096c65549354829ab (diff) | |
download | rails-746e3ad6ef3da9514aa1b1f172af4e5db6dc9797.tar.gz rails-746e3ad6ef3da9514aa1b1f172af4e5db6dc9797.tar.bz2 rails-746e3ad6ef3da9514aa1b1f172af4e5db6dc9797.zip |
Merge pull request #369 from codeodor/patch-1
Improve error message when passed unsupported type
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index f2f9d20f21..ce1fdf80ce 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -4,6 +4,12 @@ require 'arel/visitors/reduce' module Arel module Visitors + class UnsupportedVisitError < StandardError + def initialize(object) + super "Unsupported argument type: #{object.class.name}. Construct an Arel node instead." + end + end + class ToSql < Arel::Visitors::Reduce ## # This is some roflscale crazy stuff. I'm roflscaling this because @@ -737,7 +743,7 @@ module Arel end def unsupported o, collector - raise "unsupported: #{o.class.name}" + raise UnsupportedVisitError.new(o) end alias :visit_ActiveSupport_Multibyte_Chars :unsupported |