Skip to content

Commit

Permalink
catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Mar 19, 2024
1 parent b3a4d66 commit 8b94d50
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/gg2rdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,18 @@ export function gg2rdf(
const cTaxon = e.tagName === "taxonomicName"
? e
: e.querySelector("taxonomicName");
if (cTaxon) addTaxonConceptCitation(t, taxon, cTaxon);
else {
if (cTaxon) {
try {
addTaxonConceptCitation(t, taxon, cTaxon);
} catch (error) {
log(error);
t.addProperty(
"# Error:",
`Could not add TaxonConceptCitation\n${error}\n${error.stack ?? ""}`
.replace(/\n/g, "\n# "),
);
}
} else {
log(`${e.tagName} found without taxonomicName`);
}
});
Expand Down Expand Up @@ -1146,7 +1156,7 @@ export function gg2rdf(
const sigEpithet = normalizeSpace(taxonName.getAttribute(rank));
if (sigEpithet) {
return "/" +
partialURI(taxonName.getAttribute(rank).replaceAll(".", ""));
partialURI(sigEpithet.replaceAll(".", ""));
} else {
throw new Error("Could not produce taxonNameURI");
}
Expand Down

0 comments on commit 8b94d50

Please sign in to comment.