minor: fixed exception organization
This commit is contained in:
parent
3a6865e172
commit
3762e52ac2
|
@ -826,7 +826,7 @@ void Init_cbson() {
|
|||
Code = rb_const_get(mongo, rb_intern("Code"));
|
||||
rb_require("mongo/types/regexp_of_holding");
|
||||
RegexpOfHolding = rb_const_get(mongo, rb_intern("RegexpOfHolding"));
|
||||
rb_require("mongo/errors");
|
||||
rb_require("mongo/exceptions");
|
||||
InvalidName = rb_const_get(mongo, rb_intern("InvalidName"));
|
||||
InvalidStringEncoding = rb_const_get(mongo, rb_intern("InvalidStringEncoding"));
|
||||
InvalidDocument = rb_const_get(mongo, rb_intern("InvalidDocument"));
|
||||
|
|
51
lib/mongo.rb
51
lib/mongo.rb
|
@ -38,48 +38,6 @@ module Mongo
|
|||
OP_QUERY_NO_CURSOR_TIMEOUT = 16
|
||||
end
|
||||
|
||||
# Generic Mongo Ruby Driver exception class.
|
||||
class MongoRubyError < StandardError; end
|
||||
|
||||
# Raised when MongoDB itself has returned an error.
|
||||
class MongoDBError < RuntimeError; end
|
||||
|
||||
# Raised when configuration options cause connections, queries, etc., to fail.
|
||||
class ConfigurationError < MongoRubyError; end
|
||||
|
||||
# Raised when invalid arguments are sent to Mongo Ruby methods.
|
||||
class MongoArgumentError < MongoRubyError; end
|
||||
|
||||
# Raised when given a string is not valid utf-8 (Ruby 1.8 only).
|
||||
class InvalidStringEncoding < MongoRubyError; end
|
||||
|
||||
# Raised when attempting to initialize an invalid ObjectID.
|
||||
class InvalidObjectID < MongoRubyError; end
|
||||
|
||||
# Raised on failures in connection to the database server.
|
||||
class ConnectionError < MongoRubyError; end
|
||||
|
||||
# Raised on failures in connection to the database server.
|
||||
class ConnectionTimeoutError < MongoRubyError; end
|
||||
|
||||
# Raised when trying to insert a document that exceeds the 4MB limit or
|
||||
# when the document contains objects that can't be serialized as BSON.
|
||||
class InvalidDocument < MongoDBError; end
|
||||
|
||||
# Raised when a database operation fails.
|
||||
class OperationFailure < MongoDBError; end
|
||||
|
||||
# Raised when a connection operation fails.
|
||||
class ConnectionFailure < MongoDBError; end
|
||||
|
||||
# Raised when a client attempts to perform an invalid operation.
|
||||
class InvalidOperation < MongoDBError; end
|
||||
|
||||
# Raised when an invalid name is used.
|
||||
class InvalidName < RuntimeError; end
|
||||
|
||||
# Raised when the client supplies an invalid value to sort by.
|
||||
class InvalidSortValueError < MongoRubyError; end
|
||||
end
|
||||
|
||||
require 'mongo/types/binary'
|
||||
|
@ -93,9 +51,10 @@ require 'mongo/util/conversions'
|
|||
require 'mongo/util/server_version'
|
||||
require 'mongo/util/bson_ruby'
|
||||
|
||||
require 'mongo/connection'
|
||||
require 'mongo/db'
|
||||
require 'mongo/cursor'
|
||||
require 'mongo/collection'
|
||||
require 'mongo/admin'
|
||||
require 'mongo/collection'
|
||||
require 'mongo/connection'
|
||||
require 'mongo/cursor'
|
||||
require 'mongo/db'
|
||||
require 'mongo/exceptions'
|
||||
require 'mongo/gridfs'
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
# --
|
||||
# Copyright (C) 2008-2009 10gen Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ++
|
||||
|
||||
module Mongo
|
||||
# Generic Mongo Ruby Driver exception class.
|
||||
class MongoRubyError < StandardError; end
|
||||
|
||||
# Raised when MongoDB itself has returned an error.
|
||||
class MongoDBError < RuntimeError; end
|
||||
|
||||
# Raised when configuration options cause connections, queries, etc., to fail.
|
||||
class ConfigurationError < MongoRubyError; end
|
||||
|
||||
# Raised when invalid arguments are sent to Mongo Ruby methods.
|
||||
class MongoArgumentError < MongoRubyError; end
|
||||
|
||||
# Raised when given a string is not valid utf-8 (Ruby 1.8 only).
|
||||
class InvalidStringEncoding < MongoRubyError; end
|
||||
|
||||
# Raised when attempting to initialize an invalid ObjectID.
|
||||
class InvalidObjectID < MongoRubyError; end
|
||||
|
||||
# Raised on failures in connection to the database server.
|
||||
class ConnectionError < MongoRubyError; end
|
||||
|
||||
# Raised on failures in connection to the database server.
|
||||
class ConnectionTimeoutError < MongoRubyError; end
|
||||
|
||||
# Raised when trying to insert a document that exceeds the 4MB limit or
|
||||
# when the document contains objects that can't be serialized as BSON.
|
||||
class InvalidDocument < MongoDBError; end
|
||||
|
||||
# Raised when a database operation fails.
|
||||
class OperationFailure < MongoDBError; end
|
||||
|
||||
# Raised when a connection operation fails.
|
||||
class ConnectionFailure < MongoDBError; end
|
||||
|
||||
# Raised when a client attempts to perform an invalid operation.
|
||||
class InvalidOperation < MongoDBError; end
|
||||
|
||||
# Raised when an invalid name is used.
|
||||
class InvalidName < RuntimeError; end
|
||||
|
||||
# Raised when the client supplies an invalid value to sort by.
|
||||
class InvalidSortValueError < MongoRubyError; end
|
||||
end
|
Loading…
Reference in New Issue