From 6cce3e90f457a0988d52079363a80a498300daea Mon Sep 17 00:00:00 2001 From: UO281801 Date: Tue, 9 May 2023 11:35:45 +0200 Subject: [PATCH] Improved error handling in Worker --- restapi/src/repositories/pararelism/Worker.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/restapi/src/repositories/pararelism/Worker.ts b/restapi/src/repositories/pararelism/Worker.ts index edea604..74f4631 100644 --- a/restapi/src/repositories/pararelism/Worker.ts +++ b/restapi/src/repositories/pararelism/Worker.ts @@ -16,19 +16,21 @@ export class Worker { } public async run(): Promise { - let session = await getSessionFromStorage(this.sessionId); + let dataset = createSolidDataset(); - if (session == null) { - throw new Error("The user must be logged in."); - } + try{ + let session = await getSessionFromStorage(this.sessionId); - let dataset = createSolidDataset(); + if (session == null) { + throw new Error("The user must be logged in."); + } + try { + dataset = await getSolidDataset(this.resource, { + fetch: session.fetch, + }); + } catch (e) {} + }catch(e){} - try { - dataset = await getSolidDataset(this.resource, { - fetch: session.fetch, - }); - } catch (e) {} this.result = dataset; }