Exception: MongoScript::Multiquery::QueryFailedError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/mongoscript/multiquery.rb

Overview

An error class representing Mongo queries that for some reason failed in the Javascript. This error will never be raised; instead it will be returned as an object in the results array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, query, response) ⇒ QueryFailedError

Initialize the error, and set its backtrace.



16
17
18
19
20
21
22
23
# File 'lib/mongoscript/multiquery.rb', line 16

def initialize(name, query, response)
  @query_name = name
  @query_parameters = query
  @db_response = response
  super("Query #{@query_name} failed with the following response: #{response.inspect}")
  # set the backtrace to everything that's going on except this initialize method
  set_backtrace(caller[1...caller.length])
end

Instance Attribute Details

#db_responseObject

The response from the multiquery Javascript.



13
14
15
# File 'lib/mongoscript/multiquery.rb', line 13

def db_response
  @db_response
end

#query_nameObject

The name of the original query



11
12
13
# File 'lib/mongoscript/multiquery.rb', line 11

def query_name
  @query_name
end

#query_parametersObject

The original query whose execution failed.



9
10
11
# File 'lib/mongoscript/multiquery.rb', line 9

def query_parameters
  @query_parameters
end