mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Output required OAuth error fields
This commit is contained in:
@@ -2,6 +2,7 @@ import { BasicRepresentation } from '../../http/representation/BasicRepresentati
|
||||
import type { Representation } from '../../http/representation/Representation';
|
||||
import { APPLICATION_JSON, INTERNAL_ERROR } from '../../util/ContentTypes';
|
||||
import { HttpError } from '../../util/errors/HttpError';
|
||||
import { OAuthHttpError } from '../../util/errors/OAuthHttpError';
|
||||
import { getSingleItem } from '../../util/StreamUtil';
|
||||
import { BaseTypedRepresentationConverter } from './BaseTypedRepresentationConverter';
|
||||
import type { RepresentationConverterArgs } from './RepresentationConverter';
|
||||
@@ -22,6 +23,11 @@ export class ErrorToJsonConverter extends BaseTypedRepresentationConverter {
|
||||
message: error.message,
|
||||
};
|
||||
|
||||
// OAuth errors responses require additional fields
|
||||
if (OAuthHttpError.isInstance(error)) {
|
||||
Object.assign(result, error.mandatoryFields);
|
||||
}
|
||||
|
||||
if (HttpError.isInstance(error)) {
|
||||
result.statusCode = error.statusCode;
|
||||
result.errorCode = error.errorCode;
|
||||
|
||||
Reference in New Issue
Block a user