Anki/proto/anki
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
..
backend.proto Refactor error handling (#2136) 2022-10-21 18:02:12 +10:00
card_rendering.proto Partially migrate type answer to backend 2022-07-22 19:28:34 +10:00
cards.proto Add card meta for persisting custom scheduling state (#2040) 2022-09-02 11:22:49 +10:00
collection.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
config.proto Remember previous choices in reposition dialog (#1950) 2022-07-08 11:28:38 +10:00
deckconfig.proto Deck-specific Limits (#1955) 2022-07-19 18:27:25 +10:00
decks.proto Add non-legacy backend interface for adding new decks 2022-09-04 14:12:29 +10:00
generic.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
i18n.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
import_export.proto Since DupeResolution is in CsvMetadata, we don't need to pass it separately 2022-06-27 17:15:54 +10:00
links.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
media.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
notes.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
notetypes.proto Introduce setting to collapse field by default (#1990) 2022-08-31 23:34:39 +10:00
scheduler.proto Enable state-dependent custom scheduling data (#2049) 2022-09-05 16:48:01 +10:00
search.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
stats.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
sync.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
tags.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00