Exception: Mongoid::Errors::MongoidError
- Inherits:
-
StandardError
- Object
- StandardError
- Mongoid::Errors::MongoidError
- Defined in:
- lib/mongoid/errors/mongoid_error.rb
Overview
Default parent Mongoid error for all custom errors. This handles the base key for the translations and provides the convenience method for translating the messages.
Direct Known Subclasses
AmbiguousRelationship, AttributeNotLoaded, Callback, CreateCollectionFailure, CriteriaArgumentRequired, DeleteRestriction, DocumentNotDestroyed, DocumentNotFound, DropCollectionFailure, EmptyConfigFile, ImmutableAttribute, InMemoryCollationNotSupported, InvalidAutoEncryptionConfiguration, InvalidCollection, InvalidConfigFile, InvalidConfigOption, InvalidDependentStrategy, InvalidDiscriminatorKeyTarget, InvalidDotDollarAssignment, InvalidEstimatedCountCriteria, InvalidEstimatedCountScoping, InvalidField, InvalidFieldOption, InvalidFieldType, InvalidFind, InvalidGlobalExecutorConcurrency, InvalidIncludes, InvalidIndex, InvalidOptions, InvalidPath, InvalidPersistenceOption, InvalidQuery, InvalidQueryExecutor, InvalidRelation, InvalidRelationOption, InvalidScope, InvalidSessionNesting, InvalidSetPolymorphicRelation, InvalidStorageOptions, InvalidTime, InvalidTransactionNesting, InverseNotFound, MixedClientConfiguration, MixedRelations, NestedAttributesMetadataNotFound, NoClientConfig, NoClientDatabase, NoClientHosts, NoClientsConfig, NoDefaultClient, NoEnvironment, NoMapReduceOutput, NoMetadata, NoParent, ReadonlyAttribute, ReadonlyDocument, Rollback, ScopeOverwrite, SessionsNotSupported, TooManyNestedAttributeRecords, TransactionError, TransactionsNotSupported, UnknownAttribute, UnknownModel, UnsavedDocument, UnsupportedJavascript, Validations
Constant Summary collapse
- BASE_KEY =
"mongoid.errors.messages"
Instance Attribute Summary collapse
-
#problem ⇒ Object
readonly
Returns the value of attribute problem.
-
#resolution ⇒ Object
readonly
Returns the value of attribute resolution.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
Instance Method Summary collapse
-
#compose_message(key, attributes = {}) ⇒ String
Compose the message.
Instance Attribute Details
#problem ⇒ Object (readonly)
Returns the value of attribute problem.
12 13 14 |
# File 'lib/mongoid/errors/mongoid_error.rb', line 12 def problem @problem end |
#resolution ⇒ Object (readonly)
Returns the value of attribute resolution.
12 13 14 |
# File 'lib/mongoid/errors/mongoid_error.rb', line 12 def resolution @resolution end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
12 13 14 |
# File 'lib/mongoid/errors/mongoid_error.rb', line 12 def summary @summary end |
Instance Method Details
#compose_message(key, attributes = {}) ⇒ String
Compose the message.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mongoid/errors/mongoid_error.rb', line 22 def (key, attributes = {}) @problem = translate_problem(key, attributes) @summary = translate_summary(key, attributes) @resolution = translate_resolution(key, attributes) @problem_title = translate("message_title", {}) @summary_title = translate("summary_title", {}) @resolution_title = translate("resolution_title", {}) "\n#{@problem_title}:\n #{@problem}"+ "\n#{@summary_title}:\n #{@summary}"+ "\n#{@resolution_title}:\n #{@resolution}" end |