report object type where json decode fails

This commit is contained in:
Damien Elmes 2021-06-24 15:28:24 +10:00
parent d3062ceda4
commit 47284867f9
3 changed files with 7 additions and 3 deletions

View File

@ -361,7 +361,9 @@ impl SqliteStorage {
pub(crate) fn upgrade_decks_to_schema15(&self, server: bool) -> Result<()> {
let usn = self.usn(server)?;
let decks = self.get_schema11_decks()?;
let decks = self
.get_schema11_decks()
.map_err(|e| AnkiError::JsonError(format!("decoding decks: {}", e)))?;
let mut names = HashSet::new();
for (_id, deck) in decks {
let oldname = deck.name().to_string();

View File

@ -160,7 +160,7 @@ impl SqliteStorage {
let conf: Value = serde_json::from_str(text)?;
serde_json::from_value(conf)
})
.map_err(Into::into)
.map_err(|e| AnkiError::JsonError(format!("decoding deck config: {}", e)))
})?;
for (id, mut conf) in conf.into_iter() {
// buggy clients may have failed to set inner id to match hash key

View File

@ -302,7 +302,9 @@ impl SqliteStorage {
}
pub(crate) fn upgrade_notetypes_to_schema15(&self) -> Result<()> {
let nts = self.get_schema11_notetypes()?;
let nts = self
.get_schema11_notetypes()
.map_err(|e| AnkiError::JsonError(format!("decoding models: {}", e)))?;
let mut names = HashSet::new();
for (mut ntid, nt) in nts {
let mut nt = Notetype::from(nt);