github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/model/sharing/error.go (about)

     1  package sharing
     2  
     3  import "errors"
     4  
     5  var (
     6  	// ErrNoRules is used when a sharing is created without a rule
     7  	ErrNoRules = errors.New("A sharing must have rules")
     8  	// ErrNoRecipients is used when a sharing is created without a recipient
     9  	ErrNoRecipients = errors.New("A sharing must have recipients")
    10  	// ErrTooManyMembers is used when a sharing has too many members
    11  	ErrTooManyMembers = errors.New("There are too many members for this sharing")
    12  	// ErrInvalidURL is used for invalid URL of a Cozy instance
    13  	ErrInvalidURL = errors.New("The Cozy URL is invalid")
    14  	// ErrInvalidRule is used when a rule is invalid when the sharing is
    15  	// created
    16  	ErrInvalidRule = errors.New("A rule is invalid")
    17  	// ErrInvalidSharing is used when an action cannot be made on a sharing,
    18  	// because this sharing is not the expected state
    19  	ErrInvalidSharing = errors.New("Sharing is not in the expected state")
    20  	// ErrMemberNotFound is used when trying to find a member, but there is no
    21  	// member with the expected value for the criterion
    22  	ErrMemberNotFound = errors.New("The member was not found")
    23  	// ErrInvitationNotSent is used when the invitation shortcut or mail failed
    24  	// to be sent
    25  	ErrInvitationNotSent = errors.New("The invitation cannot be sent")
    26  	// ErrRequestFailed is used when a cozy tries to create a sharing request
    27  	// on another cozy, but it failed
    28  	ErrRequestFailed = errors.New("The sharing request failed")
    29  	// ErrNoOAuthClient is used when the owner of the Cozy has not yet
    30  	// registered to the recipient as an OAuth client.
    31  	ErrNoOAuthClient = errors.New("No OAuth client was found")
    32  	// ErrInternalServerError is used for CouchDB errors
    33  	ErrInternalServerError = errors.New("Internal Server Error")
    34  	// ErrClientError is used when an OAuth client has made a request, and the
    35  	// response was a 4xx error
    36  	ErrClientError = errors.New("OAuth client request was in error")
    37  	// ErrMissingID is used when _id is missing on a doc for a bulk operation
    38  	ErrMissingID = errors.New("An identifier is missing")
    39  	// ErrMissingRev is used when _rev is missing on a doc for a bulk operation
    40  	ErrMissingRev = errors.New("A revision is missing")
    41  	// ErrMissingFileMetadata is used when uploading a file and the key is not
    42  	// in the cache (so no metadata and the upload can't succeed)
    43  	ErrMissingFileMetadata = errors.New("The metadata for this file were not found")
    44  	// ErrFolderNotFound is used when informations about a folder is asked,
    45  	// but this folder was not found
    46  	ErrFolderNotFound = errors.New("This folder was not found")
    47  	// ErrSafety is used when an operation is aborted due to the safety principal
    48  	ErrSafety = errors.New("Operation aborted")
    49  	// ErrAlreadyAccepted is used when someone tries to accept twice a sharing
    50  	// on the same cozy instance
    51  	ErrAlreadyAccepted = errors.New("Sharing already accepted by this recipient")
    52  	// ErrCannotOpenFile is used when opening a file fails
    53  	ErrCannotOpenFile = errors.New("The file cannot be opened")
    54  	// ErrGroupCannotBeAddedTwice is used when trying to add a group to a
    55  	// sharing, but the group is already active for this sharing.
    56  	ErrGroupCannotBeAddedTwice = errors.New("The group cannot be added twice to the same sharing")
    57  	// ErrMemberAlreadyAdded is used when trying to add a group with a member
    58  	// already in the sharing as an individual with different rights (read-only
    59  	// vs read-write).
    60  	ErrMemberAlreadyAdded = errors.New("A group member cannot be added as they are already in the sharing")
    61  	// ErrMemberAlreadyInGroup is used when trying to add a group with a member
    62  	// already in another group of the sharing with different rights.
    63  	ErrMemberAlreadyInGroup = errors.New("A group member cannot be added as they are already in another group of the sharing")
    64  )