mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
report object type where json decode fails
This commit is contained in:
parent
d3062ceda4
commit
47284867f9
3 changed files with 7 additions and 3 deletions
|
@ -361,7 +361,9 @@ impl SqliteStorage {
|
||||||
|
|
||||||
pub(crate) fn upgrade_decks_to_schema15(&self, server: bool) -> Result<()> {
|
pub(crate) fn upgrade_decks_to_schema15(&self, server: bool) -> Result<()> {
|
||||||
let usn = self.usn(server)?;
|
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();
|
let mut names = HashSet::new();
|
||||||
for (_id, deck) in decks {
|
for (_id, deck) in decks {
|
||||||
let oldname = deck.name().to_string();
|
let oldname = deck.name().to_string();
|
||||||
|
|
|
@ -160,7 +160,7 @@ impl SqliteStorage {
|
||||||
let conf: Value = serde_json::from_str(text)?;
|
let conf: Value = serde_json::from_str(text)?;
|
||||||
serde_json::from_value(conf)
|
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() {
|
for (id, mut conf) in conf.into_iter() {
|
||||||
// buggy clients may have failed to set inner id to match hash key
|
// buggy clients may have failed to set inner id to match hash key
|
||||||
|
|
|
@ -302,7 +302,9 @@ impl SqliteStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn upgrade_notetypes_to_schema15(&self) -> Result<()> {
|
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();
|
let mut names = HashSet::new();
|
||||||
for (mut ntid, nt) in nts {
|
for (mut ntid, nt) in nts {
|
||||||
let mut nt = Notetype::from(nt);
|
let mut nt = Notetype::from(nt);
|
||||||
|
|
Loading…
Reference in a new issue