github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/pkg/apperrors/consts.go (about) 1 package apperrors 2 3 // ErrorType represents an integer error code. 4 //go:generate stringer -type ErrorType 5 type ErrorType int 6 7 const ( 8 // InternalError is the error code for Internal errors. 9 InternalError ErrorType = 10 10 // UnknownError is the error code for Unknown errors. 11 UnknownError ErrorType = 11 12 // NotFound is the error code for NotFound errors. 13 NotFound ErrorType = 20 14 // NotUnique is the error code for NotUnique errors. 15 NotUnique ErrorType = 21 16 // InvalidData is the error code for InvalidData errors. 17 InvalidData ErrorType = 22 18 // InsufficientScopes is the error code for InsufficientScopes errors. 19 InsufficientScopes ErrorType = 23 20 // TenantRequired is the error code for TenantRequired errors. 21 TenantRequired ErrorType = 24 22 // TenantNotFound is the error code for TenantNotFound errors. 23 TenantNotFound ErrorType = 25 24 // Unauthorized is the error code for Unauthorized errors. 25 Unauthorized ErrorType = 26 26 // InvalidOperation is the error code for InvalidOperation errors. 27 InvalidOperation ErrorType = 27 28 // OperationTimeout is the error code for Timeout errors. 29 OperationTimeout ErrorType = 28 30 // EmptyData is the error code for EmptyData errors. 31 EmptyData ErrorType = 29 32 // InconsistentData is the error code for InconsistentData errors. 33 InconsistentData ErrorType = 30 34 // NotUniqueName is the error code for NotUniqueName errors. 35 NotUniqueName ErrorType = 31 36 // ConcurrentOperation is the error code for ConcurrentOperation errors. 37 ConcurrentOperation ErrorType = 32 38 // InvalidStatusCondition is the error code for InvalidStatusCondition errors. 39 InvalidStatusCondition ErrorType = 33 40 // CannotUpdateObjectInManyBundles is the error code for CannotUpdateObjectInManyBundles errors. 41 CannotUpdateObjectInManyBundles ErrorType = 34 42 // ConcurrentUpdate is the error code for ConcurrentUpdate errors. 43 ConcurrentUpdate ErrorType = 35 44 // BadRequest is the error code for BadRequest errors. 45 BadRequest ErrorType = 400 46 // Conflict is the error code for Conflict errors. 47 Conflict ErrorType = 409 48 ) 49 50 const ( 51 // NotFoundMsg is the error message for NotFound errors. 52 NotFoundMsg = "Object not found" 53 // NotFoundMsgF is the error message format for NotFound errors. 54 NotFoundMsgF = "Object not found: %s" 55 // InvalidDataMsg is the error message for InvalidData errors. 56 InvalidDataMsg = "Invalid data" 57 // InternalServerErrMsgF is the error message format for InternalServer errors. 58 InternalServerErrMsgF = "Internal Server Error: %s" 59 // NotUniqueMsg is the error message for NotUnique errors. 60 NotUniqueMsg = "Object is not unique" 61 // NotUniqueMsgF is the error message format for NotUnique errors with custom message. 62 NotUniqueMsgF = "Object is not unique: %s" 63 // TenantRequiredMsg is the error message for TenantRequired errors. 64 TenantRequiredMsg = "Tenant is required" 65 // TenantNotFoundMsg is the error message for TenantNotFound errors. 66 TenantNotFoundMsg = "Tenant not found" 67 // InsufficientScopesMsg is the error message for InsufficientScopes errors. 68 InsufficientScopesMsg = "insufficient scopes provided" 69 // NoScopesInContextMsg is the error message for NoScopesInContext errors. 70 NoScopesInContextMsg = "cannot read scopes from context" 71 // NoRequiredScopesInContextMsg is the error message for NoRequiredScopesInContext errors. 72 NoRequiredScopesInContextMsg = "required scopes are not defined" 73 // KeyDoesNotExistMsg is the error message for KeyDoesNotExist errors. 74 KeyDoesNotExistMsg = "the key does not exist in the source object" 75 // CannotReadTenantMsg is the error message for CannotReadTenant errors. 76 CannotReadTenantMsg = "cannot read tenant from context" 77 // CannotReadClientUserMsg is the error message for CannotReadClientUser errors. 78 CannotReadClientUserMsg = "cannot read client_user from context" 79 // InvalidOperationMsg is the error message for InvalidOperation errors. 80 InvalidOperationMsg = "The operation is not allowed" 81 // UnauthorizedMsg is the error message for Unauthorized errors. 82 UnauthorizedMsg = "Unauthorized" 83 // OperationTimeoutMsg is the error message for Timeout errors. 84 OperationTimeoutMsg = "operation has timed out" 85 // EmptyDataMsg is the error message for EmptyData errors. 86 EmptyDataMsg = "Some required data was left out" 87 // InconsistentDataMsg is the error message for InconsistentData errors. 88 InconsistentDataMsg = "Inconsistent or out-of-range data" 89 // NotUniqueNameMsg is the error message for NotUniqueName errors. 90 NotUniqueNameMsg = "Object name is not unique" 91 // ConcurrentOperationMsg is the error message for ConcurrentOperation errors. 92 ConcurrentOperationMsg = "Concurrent operation" 93 // InvalidStatusConditionMsg is the error message for InvalidStatusCondition errors. 94 InvalidStatusConditionMsg = "Invalid status condition" 95 // CannotUpdateObjectInManyBundlesMsg is the error message for CannotUpdateObjectInManyBundles errors. 96 CannotUpdateObjectInManyBundlesMsg = "Can not update object that is part of more than one bundle" 97 // ConcurrentUpdateMsg is the error message for NewConcurrentUpdate errors. 98 ConcurrentUpdateMsg = "Could not update object due to concurrent update" 99 // ShouldUpdateSingleRowButUpdatedMsgF is the error message for ShouldUpdateSingleRowButUpdated errors. 100 ShouldUpdateSingleRowButUpdatedMsgF = "should update single row, but updated %d rows" 101 // ShouldUpsertSingleRowButUpsertedMsgF is the error message returned when upsert resulted in rows affected count not equal to 1. 102 ShouldUpsertSingleRowButUpsertedMsgF = "should upsert single row, but upserted %d rows" 103 // ShouldBeOwnerMsg is the error message for unauthorized due to missing owner access errors. 104 ShouldBeOwnerMsg = "Owner access is needed for resource modification" 105 // CannotUnassignObjectFromASA is the error message returned when trying to unassign a Runtime Context that comes from an ASA. 106 CannotUnassignObjectFromASA = "Cannot unassign object with ID coming from ASA" 107 )