mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Convert errorCodes using markdown
This commit is contained in:
@@ -4,6 +4,7 @@ export const APPLICATION_OCTET_STREAM = 'application/octet-stream';
|
||||
export const APPLICATION_SPARQL_UPDATE = 'application/sparql-update';
|
||||
export const APPLICATION_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded';
|
||||
export const TEXT_HTML = 'text/html';
|
||||
export const TEXT_MARKDOWN = 'text/markdown';
|
||||
export const TEXT_TURTLE = 'text/turtle';
|
||||
|
||||
// Internal content types (not exposed over HTTP)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { isError } from './ErrorUtil';
|
||||
export interface HttpErrorOptions {
|
||||
cause?: unknown;
|
||||
errorCode?: string;
|
||||
details?: NodeJS.Dict<unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,8 @@ export abstract class BaseIdentifierStrategy implements IdentifierStrategy {
|
||||
|
||||
public getParentContainer(identifier: ResourceIdentifier): ResourceIdentifier {
|
||||
if (!this.supportsIdentifier(identifier)) {
|
||||
throw new InternalServerError(`The identifier ${identifier.path} is outside the configured identifier space.`);
|
||||
throw new InternalServerError(`The identifier ${identifier.path} is outside the configured identifier space.`,
|
||||
{ errorCode: 'E0001', details: { path: identifier.path }});
|
||||
}
|
||||
if (this.isRootContainer(identifier)) {
|
||||
throw new InternalServerError(`Cannot obtain the parent of ${identifier.path} because it is a root container.`);
|
||||
|
||||
Reference in New Issue
Block a user