rails console などで以下を実行。
getRailsExceptionClasses
ObjectSpace.each_object(Class).select{|k| k.ancestors.include?(ActiveRecord::ActiveRecordError) }
結果:
=> [ActiveRecord::ConnectionTimeoutError,
ActiveRecord::DeleteRestrictionError,
ActiveRecord::ReadOnlyAssociation,
ActiveRecord::EagerLoadPolymorphicError,
ActiveRecord::HasAndBelongsToManyAssociationForeignKeyNeeded,
ActiveRecord::HasManyThroughNestedAssociationsAreReadonly,
ActiveRecord::HasManyThroughCantDissociateNewRecords,
ActiveRecord::HasManyThroughCantAssociateNewRecords,
ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection,
ActiveRecord::HasManyThroughSourceAssociationNotFoundError,
ActiveRecord::HasOneThroughCantAssociateThroughCollection,
ActiveRecord::HasManyThroughAssociationPointlessSourceTypeError,
ActiveRecord::HasManyThroughAssociationPolymorphicThroughError,
ActiveRecord::HasManyThroughAssociationPolymorphicSourceError,
ActiveRecord::HasManyThroughAssociationNotFoundError,
ActiveRecord::InverseOfAssociationNotFoundError,
ActiveRecord::RecordInvalid,
ActiveRecord::NestedAttributes::TooManyRecords,
ActiveRecord::Transactions::TransactionError,
ActiveRecord::UnknownPrimaryKey,
ActiveRecord::MultiparameterAssignmentErrors,
ActiveRecord::AttributeAssignmentError,
ActiveRecord::DangerousAttributeError,
ActiveRecord::Rollback,
ActiveRecord::ReadOnlyRecord,
ActiveRecord::ConfigurationError,
ActiveRecord::StaleObjectError,
ActiveRecord::PreparedStatementInvalid,
ActiveRecord::InvalidForeignKey,
ActiveRecord::RecordNotUnique,
ActiveRecord::WrappedDatabaseException,
ActiveRecord::ThrowResult,
ActiveRecord::StatementInvalid,
ActiveRecord::RecordNotSaved,
ActiveRecord::RecordNotFound,
ActiveRecord::ConnectionNotEstablished,
ActiveRecord::AdapterNotFound,
ActiveRecord::AdapterNotSpecified,
ActiveRecord::SerializationTypeMismatch,
ActiveRecord::AssociationTypeMismatch,
ActiveRecord::SubclassNotFound,
ActiveRecord::ActiveRecordError]
参考: Getting a list of existing Rails Error classes for re-use/inheritance - Stack Overflow