errors.rs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. use crate::*;
  2. use frame_support::decl_error;
  3. decl_error! {
  4. /// Content directory errors
  5. pub enum Error for Module<T: Trait> {
  6. /// Validation errors
  7. /// --------------------------------------
  8. /// Property name is too short
  9. PropertyNameTooShort,
  10. /// Property name is too long
  11. PropertyNameTooLong,
  12. /// Property description is too short
  13. PropertyDescriptionTooShort,
  14. /// Property description is too long
  15. PropertyDescriptionTooLong,
  16. /// Class name is too short
  17. ClassNameTooShort,
  18. /// Class name is too long
  19. ClassNameTooLong,
  20. /// Class description is too short
  21. ClassDescriptionTooShort,
  22. /// Class description is too long
  23. ClassDescriptionTooLong,
  24. /// Maximum number of classes limit reached
  25. ClassLimitReached,
  26. /// Maximum number of given class schemas limit reached
  27. ClassSchemasLimitReached,
  28. /// Maximum number of properties in schema limit reached
  29. SchemaPropertiesLimitReached,
  30. /// Entities creation limit per controller should be less than overall entities creation limit
  31. PerControllerEntitiesCreationLimitExceedsOverallLimit,
  32. /// Number of entities per class is to big
  33. EntitiesNumberPerClassConstraintViolated,
  34. /// Number of class entities per actor constraint violated
  35. NumberOfClassEntitiesPerActorConstraintViolated,
  36. /// Individual number of class entities per actor is too big
  37. IndividualNumberOfClassEntitiesPerActorIsTooBig,
  38. /// Number of operations during atomic batching limit reached
  39. NumberOfOperationsDuringAtomicBatchingLimitReached,
  40. /// Text property is too long
  41. TextPropertyTooLong,
  42. /// Text property to be hashed is too long
  43. HashedTextPropertyTooLong,
  44. /// Vector property is too long
  45. VecPropertyTooLong,
  46. /// Propery value vector can`t contain more values
  47. EntityPropertyValueVectorIsTooLong,
  48. /// Given property value vector index is out of range
  49. EntityPropertyValueVectorIndexIsOutOfRange,
  50. /// Main logic errors
  51. /// --------------------------------------
  52. /// Class was not found by id
  53. ClassNotFound,
  54. /// Class property under given index not found
  55. ClassPropertyNotFound,
  56. /// Unknown class schema id
  57. UnknownClassSchemaId,
  58. /// Given class schema is not active
  59. ClassSchemaNotActive,
  60. /// New class schema refers to an unknown property index
  61. ClassSchemaRefersUnknownPropertyIndex,
  62. /// New class schema refers to an unknown class id
  63. ClassSchemaRefersUnknownClass,
  64. /// Cannot add a class schema with an empty list of properties
  65. NoPropertiesInClassSchema,
  66. /// Entity was not found by id
  67. EntityNotFound,
  68. /// Cannot add a schema that is already added to this entity
  69. SchemaAlreadyAddedToTheEntity,
  70. /// Some of the provided property values don't match the expected property type
  71. PropertyValueDoNotMatchType,
  72. /// Property value don't match the expected vector property type
  73. PropertyValueDoNotMatchVecType,
  74. /// Property value under given index is not a vector
  75. PropertyValueUnderGivenIndexIsNotAVector,
  76. /// Current property value vector nonce does not equal to provided one
  77. PropertyValueVecNoncesDoesNotMatch,
  78. /// Property name is not unique within its class
  79. PropertyNameNotUniqueInAClass,
  80. /// Some required property was not found when adding schema support to entity
  81. MissingRequiredProperty,
  82. /// Schema under provided schema_id does not contain given property
  83. SchemaDoesNotContainProvidedPropertyId,
  84. /// Some of the provided property ids cannot be found on the current list of propery values of this entity
  85. UnknownEntityPropertyId,
  86. /// Entity already contains property under provided index
  87. EntityAlreadyContainsGivenPropertyId,
  88. /// Propery value type does not match internal entity vector type
  89. PropertyValueTypeDoesNotMatchInternalVectorType,
  90. /// Provided property references entity, which class_id is not equal to class_id, declared in corresponding property type
  91. ReferencedEntityDoesNotMatchItsClass,
  92. /// Entity removal can`t be completed, as there are some property values pointing to given entity
  93. EntityRcDoesNotEqualToZero,
  94. /// Entity ownership transfer can`t be completed, as there are some property values pointing to given entity with same owner flag set
  95. EntityInboundSameOwnerRcDoesNotEqualToZero,
  96. /// Provided entity controller is equal to the current one
  97. ProvidedEntityControllerIsEqualToTheCurrentOne,
  98. /// All ids of new property value references with same owner flag set should match their respective Properties defined on Class level
  99. AllProvidedPropertyValueIdsMustBeReferencesWithSameOwnerFlagSet,
  100. /// Entity was not created in batched transaction
  101. EntityNotCreatedByOperation,
  102. /// Permission errors
  103. /// --------------------------------------
  104. /// Curator group can`t be removed, as it currently maintains at least one class
  105. CuratorGroupRemovalForbidden,
  106. /// All property values, related to a given Entity were locked on Class level
  107. AllPropertiesWereLockedOnClassLevel,
  108. /// Curator under provided curator id is not a member of curaror group under given id
  109. CuratorIsNotAMemberOfGivenCuratorGroup,
  110. /// Given curator group does not exist
  111. CuratorGroupDoesNotExist,
  112. /// Entity should be referenced from the entity, owned by the same controller
  113. SameControllerConstraintViolation,
  114. /// Given maintainer does not exist
  115. MaintainerDoesNotExist,
  116. /// Given maintainer already exist
  117. MaintainerAlreadyExists,
  118. /// Provided actor can`t create entities of given class
  119. ActorCanNotCreateEntities,
  120. /// Maximum numbers of entities per class limit reached
  121. NumberOfEntitiesPerClassLimitReached,
  122. /// Current class entities creation blocked
  123. EntitiesCreationBlocked,
  124. /// Entities voucher limit reached
  125. VoucherLimitReached,
  126. /// Lead authentication failed
  127. LeadAuthFailed,
  128. /// Member authentication failed
  129. MemberAuthFailed,
  130. /// Curator authentication failed
  131. CuratorAuthFailed,
  132. /// Expected root or signed origin
  133. BadOrigin,
  134. /// Entity removal access denied
  135. EntityRemovalAccessDenied,
  136. /// Add entity schema support access denied
  137. EntityAddSchemaSupportAccessDenied,
  138. /// Class access denied
  139. ClassAccessDenied,
  140. /// Entity access denied
  141. EntityAccessDenied,
  142. /// Given entity can`t be referenced
  143. EntityCanNotBeReferenced,
  144. /// Given class property type is locked for given actor
  145. ClassPropertyTypeLockedForGivenActor,
  146. /// Number of maintainers per class limit reached
  147. ClassMaintainersLimitReached,
  148. /// Max number of curators per group limit reached
  149. CuratorsPerGroupLimitReached,
  150. /// Curator group is not active
  151. CuratorGroupIsNotActive,
  152. /// Origin cannot be made into raw origin
  153. OriginCanNotBeMadeIntoRawOrigin,
  154. /// Property value should be unique across all Entities of this Class
  155. PropertyValueShouldBeUnique
  156. }
  157. }