mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Add metadata to errors
This commit is contained in:
@@ -20,6 +20,7 @@ import { getLoggerFor } from '../../logging/LogUtil';
|
||||
import type { KeyValueStorage } from '../../storage/keyvalue/KeyValueStorage';
|
||||
import { BadRequestHttpError } from '../../util/errors/BadRequestHttpError';
|
||||
import type { HttpError } from '../../util/errors/HttpError';
|
||||
import { errorTermsToMetadata } from '../../util/errors/HttpErrorUtil';
|
||||
import { InternalServerError } from '../../util/errors/InternalServerError';
|
||||
import { OAuthHttpError } from '../../util/errors/OAuthHttpError';
|
||||
import { RedirectHttpError } from '../../util/errors/RedirectHttpError';
|
||||
@@ -398,10 +399,10 @@ export class IdentityProviderFactory implements ProviderFactory {
|
||||
const unknownClientError = new BadRequestHttpError(
|
||||
'Unknown client, you might need to clear the local storage on the client.', {
|
||||
errorCode: 'E0003',
|
||||
details: {
|
||||
client_id: ctx.request.query.client_id,
|
||||
redirect_uri: ctx.request.query.redirect_uri,
|
||||
},
|
||||
metadata: errorTermsToMetadata({
|
||||
client_id: ctx.request.query.client_id as string,
|
||||
redirect_uri: ctx.request.query.redirect_uri as string,
|
||||
}),
|
||||
},
|
||||
);
|
||||
unknownClientError.stack = oidcError.stack;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { v4 } from 'uuid';
|
||||
import { getLoggerFor } from '../../logging/LogUtil';
|
||||
import type { ExpiringStorage } from '../../storage/keyvalue/ExpiringStorage';
|
||||
import { BadRequestHttpError } from '../../util/errors/BadRequestHttpError';
|
||||
import { errorTermsToMetadata } from '../../util/errors/HttpErrorUtil';
|
||||
import { fetchDataset } from '../../util/FetchUtil';
|
||||
import { SOLID } from '../../util/Vocabularies';
|
||||
import { OwnershipValidator } from './OwnershipValidator';
|
||||
@@ -89,6 +90,6 @@ export class TokenOwnershipValidator extends OwnershipValidator {
|
||||
'You can remove this triple again after validation.',
|
||||
].join(' ');
|
||||
const details = { quad: `<${webId}> <${SOLID.oidcIssuerRegistrationToken}> "${token}".` };
|
||||
throw new BadRequestHttpError(errorMessage, { details });
|
||||
throw new BadRequestHttpError(errorMessage, { metadata: errorTermsToMetadata(details) });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user