Skip to content

Commit

Permalink
fix: Downgrade all CIP-25 parser errors to warnings (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Mar 1, 2022
1 parent 13700d2 commit 90ceecd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/mapper/cip25.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,26 @@ impl EventWriter {
self.append_from(record)?;
}
}
} else {
log::warn!("invalid metadatum type for policy inside 721 label");
}

Ok(())
}

pub(crate) fn crawl_metadata_label_721(&self, content: &Metadatum) -> Result<(), Error> {
let entries = match content {
Metadatum::Map(map) => map,
_ => return Err("expected 721 content to be a map".into()),
};

let version = self
.search_cip25_version(content)
.unwrap_or_else(|| "1.0".to_string());

for (key, sub_content) in entries.iter() {
if let Some(policy) = is_policy_key(key) {
self.crawl_721_policy(&version, &policy, sub_content)?;
if let Metadatum::Map(entries) = content {
for (key, sub_content) in entries.iter() {
if let Some(policy) = is_policy_key(key) {
self.crawl_721_policy(&version, &policy, sub_content)?;
}
}
} else {
log::warn!("invalid metadatum type for 721 label");
}

Ok(())
Expand Down

0 comments on commit 90ceecd

Please sign in to comment.