class Cuprum::Collections::Errors::InvalidQuery
An error returned when a query is created with invalid filter parameters.
Constants
- TYPE
Short string used to identify the type of error.
Attributes
errors[R]
@return [Stannum::Errors] the errors returned by the query builder.
strategy[R]
@return [Symbol] the strategy used to construct the query.
Public Class Methods
new(errors:, strategy:, message: nil)
click to toggle source
@param errors [Stannum::Errors] The errors returned by the query builder. @param strategy [Symbol] The strategy used to construct the query.
Calls superclass method
# File lib/cuprum/collections/errors/invalid_query.rb, line 15 def initialize(errors:, strategy:, message: nil) @errors = errors @strategy = strategy super( errors: errors, message: message || default_message, strategy: strategy ) end
Public Instance Methods
as_json()
click to toggle source
@return [Hash] a serializable hash representation of the error.
# File lib/cuprum/collections/errors/invalid_query.rb, line 33 def as_json { 'data' => { 'errors' => errors.to_a, 'strategy' => strategy }, 'message' => message, 'type' => type } end
type()
click to toggle source
@return [String] short string used to identify the type of error.
# File lib/cuprum/collections/errors/invalid_query.rb, line 45 def type TYPE end
Private Instance Methods
default_message()
click to toggle source
# File lib/cuprum/collections/errors/invalid_query.rb, line 51 def default_message "unable to parse query with strategy #{strategy.inspect}" end