mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Rename UnsupportedHttpError into BadRequestError.
This commit is contained in:
committed by
Joachim Van Herwegen
parent
03ffaaed43
commit
af8f1976cd
@@ -1,6 +1,7 @@
|
||||
import { getLoggerFor } from '../../logging/LogUtil';
|
||||
import type { ResourceStore } from '../../storage/ResourceStore';
|
||||
import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
|
||||
import { BadRequestHttpError } from '../../util/errors/BadRequestHttpError';
|
||||
import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError';
|
||||
import { ResetResponseDescription } from '../http/response/ResetResponseDescription';
|
||||
import type { ResponseDescription } from '../http/response/ResponseDescription';
|
||||
import type { Operation } from './Operation';
|
||||
@@ -22,14 +23,14 @@ export class PutOperationHandler extends OperationHandler {
|
||||
|
||||
public async canHandle(input: Operation): Promise<void> {
|
||||
if (input.method !== 'PUT') {
|
||||
throw new UnsupportedHttpError('This handler only supports PUT operations');
|
||||
throw new NotImplementedHttpError('This handler only supports PUT operations');
|
||||
}
|
||||
}
|
||||
|
||||
public async handle(input: Operation): Promise<ResponseDescription> {
|
||||
if (typeof input.body !== 'object') {
|
||||
this.logger.warn('No body specified on PUT request');
|
||||
throw new UnsupportedHttpError('PUT operations require a body');
|
||||
throw new BadRequestHttpError('PUT operations require a body');
|
||||
}
|
||||
await this.store.setRepresentation(input.target, input.body);
|
||||
return new ResetResponseDescription();
|
||||
|
||||
Reference in New Issue
Block a user