mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
chore: Print error details when fetchDataset fails
This commit is contained in:
parent
13dbcb662b
commit
74c2a9d909
@ -9,6 +9,7 @@ import { getLoggerFor } from '../logging/LogUtil';
|
|||||||
import type { RepresentationConverter } from '../storage/conversion/RepresentationConverter';
|
import type { RepresentationConverter } from '../storage/conversion/RepresentationConverter';
|
||||||
import { INTERNAL_QUADS } from './ContentTypes';
|
import { INTERNAL_QUADS } from './ContentTypes';
|
||||||
import { BadRequestHttpError } from './errors/BadRequestHttpError';
|
import { BadRequestHttpError } from './errors/BadRequestHttpError';
|
||||||
|
import { createErrorMessage } from './errors/ErrorUtil';
|
||||||
|
|
||||||
const logger = getLoggerFor('FetchUtil');
|
const logger = getLoggerFor('FetchUtil');
|
||||||
|
|
||||||
@ -24,8 +25,8 @@ export async function fetchDataset(url: string): Promise<Representation> {
|
|||||||
const quadStream = (await rdfDereferencer.dereference(url)).quads as Readable;
|
const quadStream = (await rdfDereferencer.dereference(url)).quads as Readable;
|
||||||
const quadArray = await arrayifyStream<Quad>(quadStream);
|
const quadArray = await arrayifyStream<Quad>(quadStream);
|
||||||
return new BasicRepresentation(quadArray, { path: url }, INTERNAL_QUADS, false);
|
return new BasicRepresentation(quadArray, { path: url }, INTERNAL_QUADS, false);
|
||||||
} catch {
|
} catch (error: unknown) {
|
||||||
throw new BadRequestHttpError(`Could not parse resource at URL (${url})!`);
|
throw new BadRequestHttpError(`Could not parse resource at URL (${url})! ${createErrorMessage(error)}`);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user