Skip to content

Commit

Permalink
fix: Don't crash when member cannot be extracted
Browse files Browse the repository at this point in the history
  • Loading branch information
smessie committed Dec 24, 2024
1 parent ac007b4 commit d43cea9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
30 changes: 17 additions & 13 deletions lib/memberManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export class Manager {
{ error: ex, type: "extract", memberId: member },
state,
);
const err = new Error();
});

promises.push(promise);
Expand Down Expand Up @@ -170,18 +169,23 @@ export class Manager {
): Promise<Member | undefined> {
if (this.state.has(member.value)) return;

const quads: Quad[] = await this.extractMemberQuads(member, data);
const created = getObjects(data, member, DC.terms.custom("created"), namedNode(LDES.custom("IngestionMetadata")))[0]?.value;

if (quads.length > 0) {
this.state.add(member.value);
return memberFromQuads(
member,
quads,
this.timestampPath,
this.isVersionOfPath,
created ? new Date(created) : undefined,
);
try {
const quads: Quad[] = await this.extractMemberQuads(member, data);
const created = getObjects(data, member, DC.terms.custom("created"), namedNode(LDES.custom("IngestionMetadata")))[0]?.value;

if (quads.length > 0) {
this.state.add(member.value);
return memberFromQuads(
member,
quads,
this.timestampPath,
this.isVersionOfPath,
created ? new Date(created) : undefined,
);
}
} catch (ex) {
this.logger.error(ex);
return;
}
}
}
26 changes: 25 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d43cea9

Please sign in to comment.