crate::err -> crate::error

This commit is contained in:
Damien Elmes 2021-04-01 16:06:24 +10:00
parent 8449bbe469
commit 094e4ad461
56 changed files with 69 additions and 69 deletions

View File

@ -29,7 +29,7 @@ pub trait Service {
}
buf.push_str(
r#"
_ => Err(crate::err::AnkiError::invalid_input("invalid command")),
_ => Err(crate::error::AnkiError::invalid_input("invalid command")),
}
}
"#,
@ -58,7 +58,7 @@ impl prost_build::ServiceGenerator for CustomGenerator {
"pub mod {name}_service {{
use super::*;
use prost::Message;
use crate::err::Result;
use crate::error::Result;
",
name = service.name.replace("Service", "").to_ascii_lowercase()
)

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::storage::SqliteStorage;
use crate::{collection::Collection, err::Result};
use crate::{collection::Collection, error::Result};
use rusqlite::types::{FromSql, FromSqlError, ToSql, ToSqlOutput, ValueRef};
use rusqlite::OptionalExtension;
use serde_derive::{Deserialize, Serialize};

View File

@ -3,7 +3,7 @@
use crate::{
backend_proto as pb,
err::{AnkiError, NetworkErrorKind, SyncErrorKind},
error::{AnkiError, NetworkErrorKind, SyncErrorKind},
prelude::*,
};

View File

@ -49,7 +49,7 @@ use crate::{
backend::dbproxy::db_command_bytes,
backend_proto as pb,
collection::Collection,
err::{AnkiError, Result},
error::{AnkiError, Result},
i18n::I18n,
};
use once_cell::sync::OnceCell;

View File

@ -6,7 +6,7 @@ use tokio::runtime::Runtime;
use crate::backend::{Backend, BackendState};
use crate::{
err::SyncErrorKind,
error::SyncErrorKind,
prelude::*,
sync::{
http::{

View File

@ -6,7 +6,7 @@ use std::sync::Arc;
use itertools::Itertools;
use serde_repr::{Deserialize_repr, Serialize_repr};
use crate::err::{AnkiError, Result};
use crate::error::{AnkiError, Result};
use crate::i18n::I18n;
use crate::{
card::{Card, CardId, CardQueue, CardType},

View File

@ -3,7 +3,7 @@
pub(crate) mod undo;
use crate::err::{AnkiError, Result};
use crate::error::{AnkiError, Result};
use crate::notes::NoteId;
use crate::{
collection::Collection, config::SchedulerVersion, prelude::*, timestamp::TimestampSecs,

View File

@ -10,7 +10,7 @@ use crate::{
storage::SqliteStorage,
undo::UndoManager,
};
use crate::{err::Result, scheduler::queue::CardQueues};
use crate::{error::Result, scheduler::queue::CardQueues};
use crate::{i18n::I18n, ops::StateChanges};
use std::{collections::HashMap, path::PathBuf, sync::Arc};

View File

@ -4,7 +4,7 @@
use crate::{
collection::Collection,
config::SchedulerVersion,
err::{AnkiError, DbErrorKind, Result},
error::{AnkiError, DbErrorKind, Result},
i18n::I18n,
notetype::{
all_stock_notetypes, AlreadyGeneratedCardInfo, CardGenContext, Notetype, NotetypeId,

View File

@ -4,7 +4,7 @@
use crate::{
collection::Collection,
define_newtype,
err::{AnkiError, Result},
error::{AnkiError, Result},
scheduler::states::review::INITIAL_EASE_FACTOR,
timestamp::{TimestampMillis, TimestampSecs},
types::Usn,

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::{collection::Collection, decks::DeckId, err::Result};
use crate::{collection::Collection, decks::DeckId, error::Result};
use std::collections::HashMap;
#[derive(Debug)]

View File

@ -17,7 +17,7 @@ use crate::{
collection::Collection,
deckconf::DeckConfId,
define_newtype,
err::{AnkiError, Result},
error::{AnkiError, Result},
prelude::*,
text::normalize_to_nfc,
timestamp::TimestampSecs,
@ -693,7 +693,7 @@ mod test {
use crate::decks::reparented_name;
use crate::{
collection::{open_test_collection, Collection},
err::Result,
error::Result,
search::SortMode,
};

View File

@ -8,7 +8,7 @@ use crate::{
config::{BoolKey, SchedulerVersion},
deckconf::{DeckConf, DeckConfId},
decks::DeckId,
err::Result,
error::Result,
timestamp::TimestampSecs,
};
use serde_tuple::Serialize_tuple;
@ -338,7 +338,7 @@ impl Collection {
#[cfg(test)]
mod test {
use super::*;
use crate::{collection::open_test_collection, deckconf::DeckConfId, err::Result};
use crate::{collection::open_test_collection, deckconf::DeckConfId, error::Result};
#[test]
fn wellformed() -> Result<()> {

View File

@ -3,7 +3,7 @@
use crate::{
collection::Collection,
err::{AnkiError, Result},
error::{AnkiError, Result},
notes::{NoteId, TransformNoteOutput},
prelude::*,
text::normalize_to_nfc,

View File

@ -14,7 +14,7 @@ pub mod config;
pub mod dbcheck;
pub mod deckconf;
pub mod decks;
pub mod err;
pub mod error;
pub mod findreplace;
pub mod i18n;
pub mod latex;

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::{AnkiError, Result};
use crate::error::{AnkiError, Result};
use crate::log::{debug, Logger};
use crate::media::database::{MediaDatabaseContext, MediaEntry};
use crate::media::files::{
@ -244,7 +244,7 @@ where
#[cfg(test)]
mod test {
use crate::err::Result;
use crate::error::Result;
use crate::media::changetracker::ChangeTracker;
use crate::media::database::MediaEntry;
use crate::media::files::sha1_of_data;

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::collection::Collection;
use crate::err::{AnkiError, DbErrorKind, Result};
use crate::error::{AnkiError, DbErrorKind, Result};
use crate::latex::extract_latex_expanding_clozes;
use crate::log::debug;
use crate::media::database::MediaDatabaseContext;
@ -511,7 +511,7 @@ pub(crate) mod test {
use super::normalize_and_maybe_rename_files;
use crate::collection::{open_collection, Collection};
use crate::err::Result;
use crate::error::Result;
use crate::i18n::I18n;
use crate::log;
use crate::media::check::{MediaCheckOutput, MediaChecker};

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::Result;
use crate::error::Result;
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
use std::collections::HashMap;
use std::path::Path;
@ -251,7 +251,7 @@ fn row_to_entry(row: &Row) -> rusqlite::Result<MediaEntry> {
#[cfg(test)]
mod test {
use crate::err::Result;
use crate::error::Result;
use crate::media::database::MediaEntry;
use crate::media::files::sha1_of_data;
use crate::media::MediaManager;

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::{AnkiError, Result};
use crate::error::{AnkiError, Result};
use crate::log::{debug, Logger};
use lazy_static::lazy_static;
use regex::Regex;

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::Result;
use crate::error::Result;
use crate::media::database::{open_or_create, MediaDatabaseContext, MediaEntry};
use crate::media::files::{add_data_to_folder_uniquely, mtime_as_i64, remove_files, sha1_of_data};
use crate::media::sync::{MediaSyncProgress, MediaSyncer};

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::{AnkiError, Result, SyncErrorKind};
use crate::error::{AnkiError, Result, SyncErrorKind};
use crate::media::changetracker::ChangeTracker;
use crate::media::database::{MediaDatabaseContext, MediaDatabaseMetadata, MediaEntry};
use crate::media::files::{
@ -808,7 +808,7 @@ fn zip_files<'a>(
#[cfg(test)]
mod test {
use crate::err::Result;
use crate::error::Result;
use crate::media::sync::{
determine_required_change, LocalState, MediaSyncProgress, RequiredChange,
};

View File

@ -7,7 +7,7 @@ use crate::{
backend_proto as pb,
decks::DeckId,
define_newtype,
err::{AnkiError, Result},
error::{AnkiError, Result},
notetype::{CardGenContext, NoteField, Notetype, NotetypeId},
prelude::*,
template::field_is_empty,
@ -570,7 +570,7 @@ fn note_differs_from_db(existing_note: &mut Note, note: &mut Note) -> bool {
mod test {
use super::{anki_base91, field_checksum};
use crate::{
collection::open_test_collection, config::BoolKey, decks::DeckId, err::Result, prelude::*,
collection::open_test_collection, config::BoolKey, decks::DeckId, error::Result, prelude::*,
search::SortMode,
};

View File

@ -8,7 +8,7 @@ use crate::{
collection::Collection,
deckconf::{DeckConf, DeckConfId},
decks::DeckId,
err::{AnkiError, Result},
error::{AnkiError, Result},
notes::{Note, NoteId},
notetype::NotetypeKind,
template::ParsedTemplate,

View File

@ -4,7 +4,7 @@
use super::{
cardgen::group_generated_cards_by_note, CardGenContext, Notetype, NotetypeId, NotetypeKind,
};
use crate::{card::CardId, collection::Collection, err::Result, notes::NoteId};
use crate::{card::CardId, collection::Collection, error::Result, notes::NoteId};
use std::collections::HashSet;
use std::fmt::Write;

View File

@ -3,7 +3,7 @@
use crate::{
backend_proto::{NoteField as NoteFieldProto, NoteFieldConfig, OptionalUInt32},
err::{AnkiError, Result},
error::{AnkiError, Result},
};
#[derive(Debug, PartialEq)]

View File

@ -26,7 +26,7 @@ use crate::{
collection::Collection,
decks::DeckId,
define_newtype,
err::{AnkiError, Result},
error::{AnkiError, Result},
notes::Note,
prelude::*,
template::{FieldRequirements, ParsedTemplate},

View File

@ -5,7 +5,7 @@ use super::{CardTemplate, Notetype, NotetypeKind};
use crate::{
card::{Card, CardId},
collection::Collection,
err::{AnkiError, Result},
error::{AnkiError, Result},
i18n::I18n,
notes::{Note, NoteId},
template::{field_is_empty, render_card, ParsedTemplate, RenderedNode},

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use super::{CardGenContext, Notetype};
use crate::{collection::Collection, err::Result};
use crate::{collection::Collection, error::Result};
/// True if any ordinals added, removed or reordered.
fn ords_changed(ords: &[Option<u32>], previous_len: usize) -> bool {
@ -137,7 +137,7 @@ impl Collection {
#[cfg(test)]
mod test {
use super::{ords_changed, TemplateOrdChanges};
use crate::{collection::open_test_collection, decks::DeckId, err::Result, search::SortMode};
use crate::{collection::open_test_collection, decks::DeckId, error::Result, search::SortMode};
#[test]
fn ord_changes() {

View File

@ -4,7 +4,7 @@
use super::NotetypeKind;
use crate::{
config::{ConfigEntry, ConfigKey},
err::Result,
error::Result,
i18n::I18n,
notetype::Notetype,
storage::SqliteStorage,

View File

@ -4,7 +4,7 @@
use crate::{
backend_proto::{CardTemplate as CardTemplateProto, CardTemplateConfig, OptionalUInt32},
decks::DeckId,
err::{AnkiError, Result},
error::{AnkiError, Result},
template::ParsedTemplate,
timestamp::TimestampSecs,
types::Usn,

View File

@ -9,7 +9,7 @@ use crate::{
},
collection::Collection,
config::BoolKey,
err::Result,
error::Result,
prelude::*,
scheduler::timing::local_minutes_west_for_stamp,
};

View File

@ -7,7 +7,7 @@ pub use crate::{
config::BoolKey,
deckconf::{DeckConf, DeckConfId},
decks::{Deck, DeckId, DeckKind},
err::{AnkiError, Result},
error::{AnkiError, Result},
i18n::I18n,
notes::{Note, NoteId},
notetype::{Notetype, NotetypeId},

View File

@ -6,7 +6,7 @@ use crate::{
card::{Card, CardId, CardQueue},
collection::Collection,
config::SchedulerVersion,
err::Result,
error::Result,
prelude::*,
search::SortMode,
};

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::{collection::Collection, config::SchedulerVersion, err::Result, prelude::*};
use crate::{collection::Collection, config::SchedulerVersion, error::Result, prelude::*};
pub mod answering;
pub mod bury_and_suspend;

View File

@ -5,7 +5,7 @@ use crate::{
card::{Card, CardId, CardQueue, CardType},
collection::Collection,
decks::DeckId,
err::Result,
error::Result,
notes::NoteId,
prelude::*,
search::SortMode,

View File

@ -6,7 +6,7 @@ use crate::{
collection::Collection,
config::StringKey,
deckconf::INITIAL_EASE_FACTOR_THOUSANDS,
err::Result,
error::Result,
prelude::*,
};
use lazy_static::lazy_static;

View File

@ -18,7 +18,7 @@ use crate::{
card::CardType,
collection::Collection,
config::{BoolKey, SortKind},
err::Result,
error::Result,
notes::NoteId,
prelude::AnkiError,
search::parser::parse,

View File

@ -3,7 +3,7 @@
use crate::{
decks::DeckId,
err::{ParseError, Result, SearchErrorKind as FailKind},
error::{ParseError, Result, SearchErrorKind as FailKind},
notetype::NotetypeId,
};
use lazy_static::lazy_static;
@ -696,7 +696,7 @@ fn is_parser_escape(txt: &str) -> bool {
#[cfg(test)]
mod test {
use crate::err::SearchErrorKind;
use crate::error::SearchErrorKind;
use super::*;
@ -858,7 +858,7 @@ mod test {
#[test]
fn errors() {
use crate::err::AnkiError;
use crate::error::AnkiError;
use FailKind::*;
fn assert_err_kind(input: &str, kind: FailKind) {

View File

@ -9,7 +9,7 @@ use crate::{
card::{CardQueue, CardType},
collection::Collection,
decks::human_deck_name_to_native,
err::Result,
error::Result,
notes::field_checksum,
notetype::NotetypeId,
prelude::*,

View File

@ -187,7 +187,7 @@ pub(crate) fn normalize_search(input: &str) -> Result<String> {
#[cfg(test)]
mod test {
use super::*;
use crate::err::Result;
use crate::error::Result;
use crate::search::parse_search as parse;
#[test]

View File

@ -7,7 +7,7 @@ use crate::{
card::{Card, CardId, CardQueue, CardType},
deckconf::DeckConfId,
decks::{Deck, DeckId, DeckKind},
err::Result,
error::Result,
notes::NoteId,
scheduler::{
congrats::CongratsInfo,

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use super::SqliteStorage;
use crate::{config::ConfigEntry, err::Result, timestamp::TimestampSecs, types::Usn};
use crate::{config::ConfigEntry, error::Result, timestamp::TimestampSecs, types::Usn};
use rusqlite::{params, NO_PARAMS};
use serde::de::DeserializeOwned;
use serde_json::Value;

View File

@ -8,7 +8,7 @@ use crate::{
config::SchedulerVersion,
decks::immediate_parent_name,
decks::{Deck, DeckCommon, DeckId, DeckKindProto, DeckSchema11, DueCounts},
err::{AnkiError, DbErrorKind, Result},
error::{AnkiError, DbErrorKind, Result},
i18n::I18n,
timestamp::TimestampMillis,
};

View File

@ -4,7 +4,7 @@
use super::SqliteStorage;
use crate::{
deckconf::{DeckConf, DeckConfId, DeckConfSchema11, DeckConfigInner},
err::Result,
error::Result,
i18n::I18n,
};
use prost::Message;

View File

@ -5,7 +5,7 @@ use super::SqliteStorage;
use crate::{
card::CardId,
decks::DeckId,
err::{AnkiError, Result},
error::{AnkiError, Result},
notes::NoteId,
sync::Graves,
types::Usn,

View File

@ -4,7 +4,7 @@
use std::collections::HashSet;
use crate::{
err::Result,
error::Result,
notes::{Note, NoteId, NoteTags},
notetype::NotetypeId,
tags::{join_tags, split_tags},

View File

@ -3,7 +3,7 @@
use super::{ids_to_string, SqliteStorage};
use crate::{
err::{AnkiError, DbErrorKind, Result},
error::{AnkiError, DbErrorKind, Result},
notes::NoteId,
notetype::{
AlreadyGeneratedCardInfo, CardTemplate, CardTemplateConfig, NoteField, NoteFieldConfig,

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use super::SqliteStorage;
use crate::err::Result;
use crate::error::Result;
use crate::{
backend_proto as pb,
prelude::*,

View File

@ -2,8 +2,8 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::config::schema11::schema11_config_as_string;
use crate::err::Result;
use crate::err::{AnkiError, DbErrorKind};
use crate::error::Result;
use crate::error::{AnkiError, DbErrorKind};
use crate::timestamp::{TimestampMillis, TimestampSecs};
use crate::{i18n::I18n, scheduler::timing::v1_creation_date, text::without_combining};
use regex::Regex;

View File

@ -3,7 +3,7 @@
use super::*;
use crate::{
err::SyncErrorKind,
error::SyncErrorKind,
prelude::*,
sync::{SanityCheckCounts, SanityCheckDueCounts},
};

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use super::SqliteStorage;
use crate::{err::Result, tags::Tag, types::Usn};
use crate::{error::Result, tags::Tag, types::Usn};
use rusqlite::{params, Row, NO_PARAMS};
use std::collections::HashMap;

View File

@ -9,7 +9,7 @@ pub(super) const SCHEMA_STARTING_VERSION: u8 = 11;
pub(super) const SCHEMA_MAX_VERSION: u8 = 18;
use super::SqliteStorage;
use crate::err::Result;
use crate::error::Result;
impl SqliteStorage {
pub(super) fn upgrade_to_latest_schema(&self, ver: u8, server: bool) -> Result<()> {

View File

@ -6,7 +6,7 @@ use super::{
Chunk, FullSyncProgress, Graves, SanityCheckCounts, SanityCheckOut, SyncMeta, UnchunkedChanges,
};
use crate::prelude::*;
use crate::{err::SyncErrorKind, notes::guid, version::sync_client_version};
use crate::{error::SyncErrorKind, notes::guid, version::sync_client_version};
use async_trait::async_trait;
use bytes::Bytes;
use flate2::write::GzEncoder;
@ -349,7 +349,7 @@ fn sync_endpoint(host_number: u32) -> String {
#[cfg(test)]
mod test {
use super::*;
use crate::{err::SyncErrorKind, sync::SanityCheckDueCounts};
use crate::{error::SyncErrorKind, sync::SanityCheckDueCounts};
use tokio::runtime::Runtime;
async fn http_client_inner(username: String, password: String) -> Result<()> {

View File

@ -10,7 +10,7 @@ use crate::{
card::{Card, CardQueue, CardType},
deckconf::DeckConfSchema11,
decks::DeckSchema11,
err::SyncErrorKind,
error::SyncErrorKind,
notes::Note,
notetype::{Notetype, NotetypeSchema11},
prelude::*,

View File

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::err::{AnkiError, Result, TemplateError};
use crate::error::{AnkiError, Result, TemplateError};
use crate::i18n::I18n;
use crate::{cloze::add_cloze_numbers_in_string, template_filters::apply_filters};
use lazy_static::lazy_static;
@ -793,7 +793,7 @@ fn find_fields_with_filter<'a>(
#[cfg(test)]
mod test {
use super::{FieldMap, ParsedNode::*, ParsedTemplate as PT};
use crate::err::TemplateError;
use crate::error::TemplateError;
use crate::{
i18n::I18n,
template::{field_is_empty, nonempty_fields, FieldRequirements, RenderContext},