Skip to content

Commit

Permalink
change: Do not warn in canHandle.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Nov 29, 2020
1 parent 10946ff commit baf6888
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/ldp/http/BasicResponseWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class BasicResponseWriter extends ResponseWriter {

public async canHandle(input: { response: HttpResponse; result: ResponseDescription | Error }): Promise<void> {
if (input.result instanceof Error || input.result.metadata?.contentType === INTERNAL_QUADS) {
this.logger.warn('This writer only supports binary ResponseDescriptions');
throw new NotImplementedHttpError('Only successful binary responses are supported');
}
}
Expand Down
1 change: 0 additions & 1 deletion src/ldp/http/ErrorResponseWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export class ErrorResponseWriter extends ResponseWriter {

public async canHandle(input: { response: HttpResponse; result: ResponseDescription | Error }): Promise<void> {
if (!(input.result instanceof Error)) {
this.logger.warn('This writer can only write errors');
throw new NotImplementedHttpError('Only errors are supported');
}
}
Expand Down
1 change: 0 additions & 1 deletion src/ldp/http/SparqlUpdateBodyParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class SparqlUpdateBodyParser extends BodyParser {
public async canHandle({ request }: BodyParserArgs): Promise<void> {
const contentType = request.headers['content-type'];
if (contentType !== APPLICATION_SPARQL_UPDATE) {
this.logger.debug(`Unsupported content type: ${contentType}`);
throw new UnsupportedMediaTypeHttpError('This parser only supports SPARQL UPDATE data.');
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/ldp/permissions/MethodPermissionsExtractor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getLoggerFor } from '../../logging/LogUtil';
import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError';
import type { Operation } from '../operations/Operation';
import type { PermissionSet } from './PermissionSet';
Expand All @@ -13,11 +12,8 @@ const SUPPORTED_METHODS = new Set([ ...READ_METHODS, ...WRITE_METHODS ]);
* Specifically: GET, HEAD, POST, PUT and DELETE.
*/
export class MethodPermissionsExtractor extends PermissionsExtractor {
protected readonly logger = getLoggerFor(this);

public async canHandle({ method }: Operation): Promise<void> {
if (!SUPPORTED_METHODS.has(method)) {
this.logger.warn(`Unrecognized method ${method}`);
throw new NotImplementedHttpError(`Cannot determine permissions of ${method}`);
}
}
Expand Down

0 comments on commit baf6888

Please sign in to comment.