package diplomail import "errors" // Sentinel errors surface common rejection reasons across the // diplomail package. Handlers map them to HTTP envelopes through // `respondDiplomailError` in `internal/server/handlers_user_mail.go`. // // Adding a new sentinel here is a deliberate API change: it appears in // the handler error map and may surface as a new wire `code` value. // Reuse the existing set when the behaviour overlaps. var ( // ErrInvalidInput reports request-level validation failures // (empty body, body or subject over the configured byte limit, // invalid UUID, non-UTF-8 bytes). Maps to 400 invalid_request. ErrInvalidInput = errors.New("diplomail: invalid input") // ErrNotFound reports that the requested message does not exist // or is not visible to the caller. Maps to 404 not_found. ErrNotFound = errors.New("diplomail: not found") // ErrForbidden reports that the caller is authenticated but not // authorised for the requested action (not an active member of // the game; not a recipient of the message). Maps to 403 // forbidden. ErrForbidden = errors.New("diplomail: forbidden") // ErrConflict reports that the requested action conflicts with // the current persisted state (e.g. soft-deleting a message // that has not been marked read yet). Maps to 409 conflict. ErrConflict = errors.New("diplomail: conflict") )