308 lines
6.7 KiB
Rust
Raw Normal View History

2023-01-30 11:11:19 +08:00
use serde_repr::*;
use thiserror::Error;
2021-12-14 18:04:51 +08:00
use flowy_derive::ProtoBuf_Enum;
#[derive(
Debug, Default, Clone, PartialEq, Eq, Error, Serialize_repr, Deserialize_repr, ProtoBuf_Enum,
)]
2023-01-30 11:11:19 +08:00
#[repr(u8)]
2021-12-14 18:04:51 +08:00
pub enum ErrorCode {
#[default]
#[error("Internal error")]
Internal = 0,
2021-12-14 18:04:51 +08:00
#[error("Unauthorized user")]
UserUnauthorized = 2,
2021-12-14 18:04:51 +08:00
#[error("Record not found")]
RecordNotFound = 3,
2021-12-14 18:04:51 +08:00
#[error("User id is empty")]
UserIdIsEmpty = 4,
2022-03-19 16:23:34 +08:00
#[error("Workspace name can not be empty or whitespace")]
WorkspaceNameInvalid = 5,
2021-12-14 18:04:51 +08:00
#[error("Workspace desc is invalid")]
WorkspaceDescTooLong = 8,
2021-12-14 18:04:51 +08:00
#[error("Workspace description too long")]
WorkspaceNameTooLong = 9,
2021-12-14 18:04:51 +08:00
#[error("Can't load the workspace data")]
WorkspaceInitializeError = 6,
2021-12-14 18:04:51 +08:00
#[error("View name can not be empty or whitespace")]
ViewNameInvalid = 12,
2021-12-14 18:04:51 +08:00
#[error("Thumbnail of the view is invalid")]
ViewThumbnailInvalid = 13,
2021-12-14 18:04:51 +08:00
#[error("View id can not be empty or whitespace")]
ViewIdIsInvalid = 14,
2021-12-14 18:04:51 +08:00
#[error("View data is invalid")]
ViewDataInvalid = 16,
2021-12-14 18:04:51 +08:00
#[error("View name too long")]
ViewNameTooLong = 17,
2021-12-14 18:04:51 +08:00
#[error("Email can not be empty or whitespace")]
EmailIsEmpty = 19,
#[error("Email format is not valid")]
EmailFormatInvalid = 20,
#[error("Email already exists")]
EmailAlreadyExists = 21,
#[error("Password can not be empty or whitespace")]
PasswordIsEmpty = 22,
#[error("Password format too long")]
PasswordTooLong = 23,
#[error("Password contains forbidden characters.")]
PasswordContainsForbidCharacters = 24,
#[error(
"Password should contain a minimum of 6 characters with 1 special 1 letter and 1 numeric"
)]
PasswordFormatInvalid = 25,
#[error("Password not match")]
PasswordNotMatch = 26,
#[error("User name is too long")]
UserNameTooLong = 27,
#[error("User name contain forbidden characters")]
UserNameContainForbiddenCharacters = 28,
#[error("User name can not be empty or whitespace")]
UserNameIsEmpty = 29,
#[error("user id is empty or whitespace")]
UserIdInvalid = 30,
2023-01-30 11:11:19 +08:00
#[error("Text is too long")]
TextTooLong = 32,
#[error("Database id is empty")]
DatabaseIdIsEmpty = 33,
#[error("Grid view id is empty")]
DatabaseViewIdIsEmpty = 34,
2022-08-16 15:49:54 +08:00
#[error("Grid block id is empty")]
BlockIdIsEmpty = 35,
#[error("Row id is empty")]
RowIdIsEmpty = 36,
#[error("Select option id is empty")]
OptionIdIsEmpty = 37,
#[error("Field id is empty")]
FieldIdIsEmpty = 38,
#[error("Field doesn't exist")]
FieldDoesNotExist = 39,
#[error("The name of the option should not be empty")]
SelectOptionNameIsEmpty = 40,
#[error("Field not exists")]
FieldNotExists = 41,
#[error("The operation in this field is invalid")]
FieldInvalidOperation = 42,
#[error("Filter id is empty")]
FilterIdIsEmpty = 43,
#[error("Field is not exist")]
FieldRecordNotFound = 44,
2022-03-27 09:35:10 +08:00
#[error("Field's type-option data should not be empty")]
TypeOptionDataIsEmpty = 45,
#[error("Group id is empty")]
GroupIdIsEmpty = 46,
#[error("Invalid date time format")]
InvalidDateTimeFormat = 48,
2022-05-13 22:58:49 +08:00
#[error("Invalid params")]
InvalidParams = 49,
#[error("Serde")]
Serde = 50,
#[error("Protobuf serde")]
ProtobufSerde = 51,
2022-11-15 13:04:30 +08:00
#[error("Out of bounds")]
OutOfBounds = 52,
#[error("Sort id is empty")]
SortIdIsEmpty = 53,
2023-01-30 11:11:19 +08:00
#[error("Connect refused")]
ConnectRefused = 54,
2023-01-30 11:11:19 +08:00
#[error("Connection timeout")]
ConnectTimeout = 55,
2023-01-30 11:11:19 +08:00
#[error("Connection closed")]
ConnectClose = 56,
2023-01-30 11:11:19 +08:00
#[error("Connection canceled")]
ConnectCancel = 57,
2023-01-30 11:11:19 +08:00
#[error("Sql error")]
SqlError = 58,
2023-01-30 11:11:19 +08:00
feat: migrate user data to cloud (#3078) * refactor: weak passed-in params in handler * refactor: rename struct * chore: update tables * chore: update schema * chore: add permission * chore: update tables * chore: support transaction mode * chore: workspace database id * chore: add user workspace * feat: return list of workspaces * chore: add user to workspace * feat: separate database row table * refactor: update schema * chore: partition table * chore: use transaction * refactor: dir * refactor: collab db ref * fix: collab db lock * chore: rename files * chore: add tables descriptions * chore: update readme * docs: update documentation * chore: rename crate * chore: update ref * chore: update tests * chore: update tests * refactor: crate deps * chore: update crate ref * chore: remove unused deps * chore: remove unused deps * chore: update collab crate refs * chore: replace client with transaction in pooler * refactor: return error type * refactor: use anyhow error in deps * feat: supabase postgrest user signin (wip) * fix: Cargo.toml source git deps, changed Error to anyhow::Error * fix: uuid serialization * chore: fix conflict * chore: extend the response * feat: add implementation place holders * feat: impl get_user_workspaces * feat: impl get_user_profile * test: create workspace * fix: postgrest: field names and alias * chore: implement folder restful api * chore: implement collab storate with restful api * feat: added placeholders for impl: update_user_profile, check_user * feat: impl: update_user_profile * feat: impl: check_user * fix: use UidResponse, add more debug info for serde serialization error * fix: get_user_profile: use Optional<UserProfileResponse> * chore: imple init sync * chore: support soft delete * feat: postgresql: add migration test * feat: postgresql migration test: added UID display and colored output * feat: postgresql migration test: workspace role * feat: postgresql migration test: create shared common utils * feat: postgresql migration test: fixed shebang * chore: add flush_collab_update pg function * chore: implement datbaase and document restful api * chore: migrate to use restful api * chore: update table schema * chore: fix tests * chore: remove unused code * chore: format code * chore: remove unused env * fix: tauri build * fix: tauri build --------- Co-authored-by: Fu Zi Xiang <speed2exe@live.com.sg>
2023-07-29 09:46:24 +08:00
#[error("Http error")]
HttpError = 59,
2023-01-30 11:11:19 +08:00
#[error("The content should not be empty")]
UnexpectedEmpty = 60,
#[error("Only the date type can be used in calendar")]
UnexpectedCalendarFieldType = 61,
#[error("Document Data Invalid")]
DocumentDataInvalid = 62,
#[error("Unsupported auth type")]
UnsupportedAuthType = 63,
#[error("Invalid auth configuration")]
InvalidAuthConfig = 64,
#[error("Missing auth field")]
MissingAuthField = 65,
#[error("Rocksdb IO error")]
RocksdbIOError = 66,
#[error("Document id is empty")]
DocumentIdIsEmpty = 67,
#[error("Apply actions is empty")]
ApplyActionsIsEmpty = 68,
#[error("Connect postgres database failed")]
PgConnectError = 69,
#[error("Postgres database error")]
PgDatabaseError = 70,
feat: migrate user data to cloud (#3078) * refactor: weak passed-in params in handler * refactor: rename struct * chore: update tables * chore: update schema * chore: add permission * chore: update tables * chore: support transaction mode * chore: workspace database id * chore: add user workspace * feat: return list of workspaces * chore: add user to workspace * feat: separate database row table * refactor: update schema * chore: partition table * chore: use transaction * refactor: dir * refactor: collab db ref * fix: collab db lock * chore: rename files * chore: add tables descriptions * chore: update readme * docs: update documentation * chore: rename crate * chore: update ref * chore: update tests * chore: update tests * refactor: crate deps * chore: update crate ref * chore: remove unused deps * chore: remove unused deps * chore: update collab crate refs * chore: replace client with transaction in pooler * refactor: return error type * refactor: use anyhow error in deps * feat: supabase postgrest user signin (wip) * fix: Cargo.toml source git deps, changed Error to anyhow::Error * fix: uuid serialization * chore: fix conflict * chore: extend the response * feat: add implementation place holders * feat: impl get_user_workspaces * feat: impl get_user_profile * test: create workspace * fix: postgrest: field names and alias * chore: implement folder restful api * chore: implement collab storate with restful api * feat: added placeholders for impl: update_user_profile, check_user * feat: impl: update_user_profile * feat: impl: check_user * fix: use UidResponse, add more debug info for serde serialization error * fix: get_user_profile: use Optional<UserProfileResponse> * chore: imple init sync * chore: support soft delete * feat: postgresql: add migration test * feat: postgresql migration test: added UID display and colored output * feat: postgresql migration test: workspace role * feat: postgresql migration test: create shared common utils * feat: postgresql migration test: fixed shebang * chore: add flush_collab_update pg function * chore: implement datbaase and document restful api * chore: migrate to use restful api * chore: update table schema * chore: fix tests * chore: remove unused code * chore: format code * chore: remove unused env * fix: tauri build * fix: tauri build --------- Co-authored-by: Fu Zi Xiang <speed2exe@live.com.sg>
2023-07-29 09:46:24 +08:00
#[error("Postgres transaction error")]
PgTransactionError = 71,
#[error("Enable data sync")]
DataSyncRequired = 72,
feat: migrate user data to cloud (#3078) * refactor: weak passed-in params in handler * refactor: rename struct * chore: update tables * chore: update schema * chore: add permission * chore: update tables * chore: support transaction mode * chore: workspace database id * chore: add user workspace * feat: return list of workspaces * chore: add user to workspace * feat: separate database row table * refactor: update schema * chore: partition table * chore: use transaction * refactor: dir * refactor: collab db ref * fix: collab db lock * chore: rename files * chore: add tables descriptions * chore: update readme * docs: update documentation * chore: rename crate * chore: update ref * chore: update tests * chore: update tests * refactor: crate deps * chore: update crate ref * chore: remove unused deps * chore: remove unused deps * chore: update collab crate refs * chore: replace client with transaction in pooler * refactor: return error type * refactor: use anyhow error in deps * feat: supabase postgrest user signin (wip) * fix: Cargo.toml source git deps, changed Error to anyhow::Error * fix: uuid serialization * chore: fix conflict * chore: extend the response * feat: add implementation place holders * feat: impl get_user_workspaces * feat: impl get_user_profile * test: create workspace * fix: postgrest: field names and alias * chore: implement folder restful api * chore: implement collab storate with restful api * feat: added placeholders for impl: update_user_profile, check_user * feat: impl: update_user_profile * feat: impl: check_user * fix: use UidResponse, add more debug info for serde serialization error * fix: get_user_profile: use Optional<UserProfileResponse> * chore: imple init sync * chore: support soft delete * feat: postgresql: add migration test * feat: postgresql migration test: added UID display and colored output * feat: postgresql migration test: workspace role * feat: postgresql migration test: create shared common utils * feat: postgresql migration test: fixed shebang * chore: add flush_collab_update pg function * chore: implement datbaase and document restful api * chore: migrate to use restful api * chore: update table schema * chore: fix tests * chore: remove unused code * chore: format code * chore: remove unused env * fix: tauri build * fix: tauri build --------- Co-authored-by: Fu Zi Xiang <speed2exe@live.com.sg>
2023-07-29 09:46:24 +08:00
#[error("Conflict")]
Conflict = 73,
#[error("Invalid decryption secret")]
InvalidEncryptSecret = 74,
#[error("It appears that the collaboration object's data has not been fully synchronized")]
CollabDataNotSync = 75,
#[error("It appears that the workspace data has not been fully synchronized")]
WorkspaceDataNotSync = 76,
#[error("Excess storage limited")]
ExcessStorageLimited = 77,
#[error("Parse url failed")]
InvalidURL = 78,
#[error("Require Email Confirmation, Sign in after email confirmation")]
AwaitingEmailConfirmation = 79,
#[error("Text id is empty")]
TextIdIsEmpty = 80,
#[error("Record already exists")]
RecordAlreadyExists = 81,
#[error("Missing payload")]
MissingPayload = 82,
feat: integrate client-api (#3430) * chore: update client-api rev * chore: update collab rev id * feat: add sign_in_request and import shared entity * feat: added to userworkspace from af_workspace * chore: add script to update the client-api rev id * chore: update client-api rev * feat: add workspaces api * feat: added check user * chore: config * chore: update client_api version * chore: ws connect * chore: ws connect * chore: update crate versions * chore: rename event * chore: update client-appi * chore: set appflowy cloud env * chore: add env template * chore: update env name * docs: update docs * fix: check_user * feat: impl sign_in_with_url * feat: add file storage placeholders * chore: update client-api * chore: disable test * feat: impl workspace add and remove * chore: sign up test * feat: select cover image on upload (#3488) * fix: close popover after item selection in settings view (#3362) * fix: close popover after item selection in settings view * fix: add missing await before closing popover * fix: find popover container by context instead of passing controllers around * fix: add requested changes * feat: close text direction settings popups after selection * fix: clean up * fix: restore theme value dropdown as StatefulWidget * feat: openai and stabilityai integration (#3439) * chore: create trait * test: add tests * chore: remove log * chore: disable log * chore: checklist ux flow redesign (#3418) * chore: ux flow redesign * chore: remove unused imports * fix: allow creation of tasks of the same name * chore: apply code suggestions from Mathias * fix: add padding below field title text field (#3440) * Fixed Issue no #3426 * Reversed the pubspec.lock mistaken update * FIXED PADDING * Fixed Padding issue on calender field edit popup * chore: rename package name (#3501) * fix: right icon size sam as left one (#3494) * feat: enable removing user icon (#3487) * feat: enable removing user icon * fix: generate to true * fix: review comments * fix: more review comments * fix: integration test and final changes * fix: made cursor grab and background color when hovering on Appearance Options Buttons (#3498) * chore: calendar UI polish (#3484) * chore: update calendar theming * feat: add event popup editor * chore: new event button redesign and add card shadows * chore: unscheduled events button * chore: event title text field * fix: focus node double dispose * chore: show popover when create new event * test: integrate some tests for integration testing purposes * fix: some fixes and more integration tests * chore: add more space between font item and font menu * feat: add reset font button in toolbar * feat: only show text direction toolbar item when RTL is enabled * fix: unable to change RTL of heading block * test: add integration test for ltr/rtl mode * chore: update inlang project settings (#3441) * feat: using script to update the collab source. (#3508) * chore: add script * chore: update script * chore: update bytes version * chore: submit lock file * chore: update test * chore: update test * chore: bump version * chore: update * ci: fix * ci: fix * chore: update commit id * chore: update commit id * chore: update commit id * fix: is cloud enable --------- Co-authored-by: Fu Zi Xiang <speed2exe@live.com.sg> Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com> Co-authored-by: Vincenzo De Petris <37916223+vincendep@users.noreply.github.com> Co-authored-by: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Co-authored-by: Aryan More <61151896+aryan-more@users.noreply.github.com> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Co-authored-by: Nitin-Poojary <70025277+Nitin-Poojary@users.noreply.github.com> Co-authored-by: Jannes Blobel <72493222+jannesblobel@users.noreply.github.com>
2023-10-02 17:22:22 +08:00
#[error("Permission denied")]
NotEnoughPermissions = 83,
#[error("Internal server error")]
InternalServerError = 84,
#[error("Not support yet")]
NotSupportYet = 85,
#[error("rocksdb corruption")]
RocksdbCorruption = 86,
#[error("rocksdb internal error")]
RocksdbInternal = 87,
#[error("Local version not support")]
LocalVersionNotSupport = 88,
#[error("AppFlowy data folder import error")]
AppFlowyDataFolderImportError = 89,
#[error("Cloud request payload too large")]
CloudRequestPayloadTooLarge = 90,
#[error("Workspace limit exceeded")]
2024-03-22 16:15:18 +07:00
WorkspaceLimitExceeded = 91,
#[error("Workspace member limit exceeded")]
2024-03-22 16:15:18 +07:00
WorkspaceMemberLimitExceeded = 92,
feat: search mvp (#5064) * feat: implement folder indexer * feat: sqlite search views using fts5 * feat: add view indexing to user manager * feat: implement folder indexer * feat: add sqlite search documents * feat: add document indexing to user manager * feat: add document indexing to folder indexer * chore: update collab rev * feat: search frontend integration * refactor: search index * test: add event test * chore: fix ci * feat: initial command palette overlay impl (#4619) * chore: test search engine * chore: initial structure * chore: replace old search request * chore: enable log for lib-dispatch * chore: move search manager to core * feat: move traits and responsibility to search crate * feat: move search to search crate * feat: replace sqlite with tantivy * feat: deserialize tantivy documents * chore: fixes after rebase * chore: clean code * feat: fetch and sort results * fix: code review + cleaning * feat: support custom icons * feat: support view layout icons * feat: rename bloc and fix indexing * fix: prettify dialog * feat: score results * chore: update collab rev * feat: add recent view history to command palette * test: add integration_tests * fix: clippy changes * fix: focus traversal in cmd palette * fix: remove file after merging main * chore: code review and panic-safe * feat: index all views if index does not exist * chore: improve logic with conditional * chore: add is_empty check * chore: abstract logic from folder manager init * chore: update collab rev * chore: code review * chore: fixes after merge + update lock file * chore: revert cargo lock * fix: set icon type when removing icon * fix: code review + dependency inversion * fix: remove icon fix for not persisting icon type * test: simple tests manipulating views * test: create 100 views * fix: tauri build * chore: create 1000 views * chore: create util methods * chore: test * chore: test * chore: remove logs * chore: fix build.rs * chore: export models * chore: enable clear cache on Rust-CI * fix: navigate to newly created views * fix: force disable setting workspace listener on rebuilds * fix: remove late final * fix: missing returns * fix: localization and minor fixes * test: add index assert to large test * fix: missing section param after merging main * chore: try fix unzip file error * chore: lower the test * feat: show hint when result is in trash * feat: one index_writer per index * fix: minor changes after merge * fix: make create_log_filter public after merge * chore: fix test * chore: fix test * chore: flutter analyze * chore: flutter analyze * chore: fix tauri build --------- Co-authored-by: nathan <nathan@appflowy.io> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: Nathan.fooo <86001920+appflowy@users.noreply.github.com>
2024-04-12 10:21:41 +02:00
#[error("IndexWriter failed to commit")]
IndexWriterFailedCommit = 93,
#[error("Failed to open Index directory")]
FailedToOpenIndexDir = 94,
#[error("Failed to parse query")]
FailedToParseQuery = 95,
#[error("FolderIndexManager or its dependencies are unavailable")]
FolderIndexManagerUnavailable = 96,
#[error("Workspace data not match")]
WorkspaceDataNotMatch = 97,
#[error("Local AI error")]
LocalAIError = 98,
#[error("Local AI unavailable")]
LocalAIUnavailable = 99,
feat: ai billing (#5741) * feat: start on AI plan+billing UI * chore: enable plan and billing * feat: cache workspace subscription + minor fixes (#5705) * feat: update api from billing * feat: add api for workspace subscription info (#5717) * feat: refactor and start integrating AI plans * feat: refine UI and add business logic for AI * feat: complete UIUX for AI and limits * chore: remove resolved todo * chore: localize remove addon dialog * chore: fix spacing issue for usage * fix: interpret subscription + usage on action * chore: update api for billing (#5735) * chore: update revisions * fix: remove subscription cache * fix: copy improvements + use consistent dialog * chore: update to the latest client api * feat: support updating billing period * Feat/ai billing cancel reason (#5752) * chore: add cancellation reason field * fix: ci add one retry for concurrent sign up * chore: merge with main * chore: half merge * chore: fix conflict * chore: observer error * chore: remove unneeded protobuf and remove unwrap * feat: added subscription plan details * chore: check error code and update sidebar toast * chore: periodically check billing state * chore: editor ai error * chore: return file upload error * chore: fmt * chore: clippy * chore: disable upload image when exceed storage limitation * chore: remove todo * chore: remove openai i18n * chore: update log * chore: update client-api to fix stream error * chore: clippy * chore: fix language file * chore: disable billing UI --------- Co-authored-by: Zack Fu Zi Xiang <speed2exe@live.com.sg> Co-authored-by: nathan <nathan@appflowy.io>
2024-07-22 09:43:48 +02:00
#[error("File storage limit exceeded")]
FileStorageLimitExceeded = 100,
#[error("AI Response limit exceeded")]
AIResponseLimitExceeded = 101,
#[error("Duplicate record")]
DuplicateSqliteRecord = 102,
#[error("Response timeout")]
ResponseTimeout = 103,
2021-12-14 18:04:51 +08:00
}
impl ErrorCode {
pub fn value(&self) -> i32 {
self.clone() as i32
}
2021-12-14 18:04:51 +08:00
}