From 74c2a9d9093114bc187bb8d457501ee70f11b39e Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Thu, 12 May 2022 16:39:45 +0200 Subject: [PATCH] chore: Print error details when fetchDataset fails --- src/util/FetchUtil.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/FetchUtil.ts b/src/util/FetchUtil.ts index bb5a99a30..23d48408e 100644 --- a/src/util/FetchUtil.ts +++ b/src/util/FetchUtil.ts @@ -9,6 +9,7 @@ import { getLoggerFor } from '../logging/LogUtil'; import type { RepresentationConverter } from '../storage/conversion/RepresentationConverter'; import { INTERNAL_QUADS } from './ContentTypes'; import { BadRequestHttpError } from './errors/BadRequestHttpError'; +import { createErrorMessage } from './errors/ErrorUtil'; const logger = getLoggerFor('FetchUtil'); @@ -24,8 +25,8 @@ export async function fetchDataset(url: string): Promise { const quadStream = (await rdfDereferencer.dereference(url)).quads as Readable; const quadArray = await arrayifyStream(quadStream); return new BasicRepresentation(quadArray, { path: url }, INTERNAL_QUADS, false); - } catch { - throw new BadRequestHttpError(`Could not parse resource at URL (${url})!`); + } catch (error: unknown) { + throw new BadRequestHttpError(`Could not parse resource at URL (${url})! ${createErrorMessage(error)}`); } })(); }