Skip to content

Commit

Permalink
remove try-catch which result in errors
Browse files Browse the repository at this point in the history
(at processTicksAndRejections (node:internal/process/task_queues:96:5)
  • Loading branch information
Elodie Thiéblin committed Oct 10, 2023
1 parent 68d74f3 commit f840ac2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
20 changes: 6 additions & 14 deletions tdd/lib/frame-jsonld.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ console.log(data);
const framedata = process.argv[3];

async function frame() {
try {
const doc = await jsonld.fromRDF(data, {
format: "application/n-quads",
useNativeTypes: "true",
});
try {
const framed = await jsonld.frame(doc, JSON.parse(framedata));
return JSON.stringify(framed, null, 2);
} catch (error) {
throw new Error(418);
}
} catch (error) {
throw new Error(418);
}
const doc = await jsonld.fromRDF(data, {
format: "application/n-quads",
useNativeTypes: "true",
});
const framed = await jsonld.frame(doc, JSON.parse(framedata));
return JSON.stringify(framed, null, 2);
}

frame().then(console.log);
12 changes: 4 additions & 8 deletions tdd/lib/transform-to-nt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ const jsonld = require("jsonld");
const data = process.argv[2];

async function transform() {
try {
const rdf = await jsonld.toRDF(JSON.parse(data), {
format: "application/n-quads",
});
return rdf;
} catch (error) {
throw new Error(418);
}
const rdf = await jsonld.toRDF(JSON.parse(data), {
format: "application/n-quads",
});
return rdf;
}

transform().then(console.log);

0 comments on commit f840ac2

Please sign in to comment.