From f840ac2dfb430fbdb5fcca32c7bee3ba2eee4ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elodie=20Thi=C3=A9blin?= Date: Tue, 10 Oct 2023 12:53:42 +0200 Subject: [PATCH] remove try-catch which result in errors (at processTicksAndRejections (node:internal/process/task_queues:96:5) --- tdd/lib/frame-jsonld.js | 20 ++++++-------------- tdd/lib/transform-to-nt.js | 12 ++++-------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/tdd/lib/frame-jsonld.js b/tdd/lib/frame-jsonld.js index aa42999..280ed84 100644 --- a/tdd/lib/frame-jsonld.js +++ b/tdd/lib/frame-jsonld.js @@ -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); diff --git a/tdd/lib/transform-to-nt.js b/tdd/lib/transform-to-nt.js index 5b047d8..15f3198 100644 --- a/tdd/lib/transform-to-nt.js +++ b/tdd/lib/transform-to-nt.js @@ -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);