Anki/rslib/src/storage/card
RumovZ c521753057
Refactor error handling (#2136)
* Add crate snafu

* Replace all inline structs in AnkiError

* Derive Snafu on AnkiError

* Use snafu for card type errors

* Use snafu whatever error for InvalidInput

* Use snafu for NotFoundError and improve message

* Use snafu for FileIoError to attach context

Remove IoError.
Add some context-attaching helpers to replace code returning bare
io::Errors.

* Add more context-attaching io helpers

* Add message, context and backtrace to new snafus

* Utilize error context and backtrace on frontend

* Rename LocalizedError -> BackendError.
* Remove DocumentedError.
* Have all backend exceptions inherit BackendError.

* Rename localized(_description) -> message

* Remove accidentally committed experimental trait

* invalid_input_context -> ok_or_invalid

* ensure_valid_input! -> require!

* Always return `Err` from `invalid_input!`

Instead of a Result to unwrap, the macro accepts a source error now.

* new_tempfile_in_parent -> new_tempfile_in_parent_of

* ok_or_not_found -> or_not_found

* ok_or_invalid -> or_invalid

* Add crate convert_case

* Use unqualified lowercase type name

* Remove uses of snafu::ensure

* Allow public construction of InvalidInputErrors (dae)

Needed to port the AnkiDroid changes.

* Make into_protobuf() public (dae)

Also required for AnkiDroid. Not sure why it worked previously - possible
bug in older Rust version?
2022-10-21 18:02:12 +10:00
..
active_new_cards.sql V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
add_card.sql reformat .sql files 2021-01-09 14:08:55 +10:00
add_card_if_unique.sql Add apkg import/export on backend (#1743) 2022-05-02 21:12:46 +10:00
add_or_update.sql reformat .sql files 2021-01-09 14:08:55 +10:00
at_or_above_position.sql reformat .sql files 2021-01-09 14:08:55 +10:00
congrats.sql reformat .sql files 2021-01-09 14:08:55 +10:00
data.rs Refactor error handling (#2136) 2022-10-21 18:02:12 +10:00
due_cards.sql revert some interday learning changes in v3 2021-08-19 16:40:12 +10:00
filtered.rs order by template after note id in filtered decks 2021-12-10 18:53:50 +10:00
fix_due_new.sql reformat .sql files 2021-01-09 14:08:55 +10:00
fix_due_other.sql reformat .sql files 2021-01-09 14:08:55 +10:00
fix_ivl.sql reformat .sql files 2021-01-09 14:08:55 +10:00
fix_low_ease.sql avoid bumping mtime when correcting card eases on upgrade 2021-01-28 08:11:35 +10:00
fix_odue.sql fix spurious warning in db check for v1 scheduler+non-zero lapse ivl% 2021-03-19 22:57:43 +10:00
fix_ordinal.sql catch invalid card ordinals in DB check 2021-06-29 10:50:03 +10:00
get_card.sql reformat .sql files 2021-01-09 14:08:55 +10:00
intraday_due.sql rework various aspects of the test scheduler 2021-05-16 20:23:07 +10:00
mod.rs Add card meta for persisting custom scheduling state (#2040) 2022-09-02 11:22:49 +10:00
new_cards.sql V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
search_cards_of_notes_into_table.sql Add apkg import/export on backend (#1743) 2022-05-02 21:12:46 +10:00
search_cids_setup.sql reformat .sql files 2021-01-09 14:08:55 +10:00
search_cids_setup_ordered.sql reformat .sql files 2021-01-09 14:08:55 +10:00
siblings_for_bury.sql Config for burying interday learning cards (#1680) 2022-02-22 21:37:59 +10:00
update_card.sql reformat .sql files 2021-01-09 14:08:55 +10:00