Class: Mongo::Error::MaxBSONSize
- Inherits:
-
Error
- Object
- Error
- Mongo::Error::MaxBSONSize
- Defined in:
- lib/mongo/error/max_bson_size.rb
Overview
Exception that is raised when trying to serialize a document that exceeds max BSON object size.
Constant Summary collapse
- MESSAGE =
The message is constant.
'The document exceeds maximum allowed BSON size'
Instance Method Summary collapse
-
#initialize(max_size_or_msg = nil) ⇒ MaxBSONSize
constructor
Instantiate the new exception.
Constructor Details
#initialize(max_size_or_msg = nil) ⇒ MaxBSONSize
Instantiate the new exception.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mongo/error/max_bson_size.rb', line 39 def initialize(max_size_or_msg = nil) msg = if max_size_or_msg.is_a?(Numeric) "#{MESSAGE}. The maximum allowed size is #{max_size_or_msg}" elsif max_size_or_msg max_size_or_msg else MESSAGE end super(msg) end |