Exception: Mongoid::Errors::InvalidQuery
- Inherits:
-
MongoidError
- Object
- StandardError
- MongoidError
- Mongoid::Errors::InvalidQuery
- Defined in:
- lib/mongoid/errors/invalid_query.rb
Overview
Raised when invalid query is passed to an embedded matcher, or an invalid query fragment is passed to the query builder (Criteria object).
Direct Known Subclasses
InvalidElemMatchOperator, InvalidExpressionOperator, InvalidFieldOperator
Constant Summary
Constants inherited from MongoidError
Instance Attribute Summary
Attributes inherited from MongoidError
#problem, #resolution, #summary
Class Method Summary collapse
-
.truncate_expr(expr) ⇒ Object
private
Stringifies the argument using #inspect and truncates the result to about 100 characters.
Instance Method Summary collapse
-
#initialize(msg) ⇒ InvalidQuery
constructor
private
Create the new invalid query error.
Methods inherited from MongoidError
Constructor Details
#initialize(msg) ⇒ InvalidQuery
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create the new invalid query error.
14 15 16 |
# File 'lib/mongoid/errors/invalid_query.rb', line 14 def initialize(msg) super end |
Class Method Details
.truncate_expr(expr) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Stringifies the argument using #inspect and truncates the result to about 100 characters.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mongoid/errors/invalid_query.rb', line 24 def self.truncate_expr(expr) unless expr.is_a?(String) expr = expr.inspect end if expr.length > 103 expr = if expr =~ /\A<#((?:.|\n)*)>\z/ "<##{expr.slice(0, 97)}...>" else expr.slice(0, 100) + '...' end end expr end |