lib/sup/util/query.rb in sup-0.14.1.1 vs lib/sup/util/query.rb in sup-0.15.0
- old
+ new
@@ -1,13 +1,16 @@
module Redwood
module Util
module Query
class QueryDescriptionError < ArgumentError; end
- def self.describe query
+ def self.describe(query, fallback = nil)
d = query.description.force_encoding("UTF-8")
- raise QueryDescriptionError.new(d) unless d.valid_encoding?
+ unless d.valid_encoding?
+ raise QueryDescriptionError.new(d) unless fallback
+ d = fallback
+ end
return d
end
end
end
end