diff --git a/src/controllers/oai.controller.ts b/src/controllers/oai.controller.ts index 673d295..471c729 100644 --- a/src/controllers/oai.controller.ts +++ b/src/controllers/oai.controller.ts @@ -187,13 +187,18 @@ export class OaiController { this.handleIllegalVerb(); } } else { - // try { - // console.log("Async code example.") - const err = new PageNotFoundException("verb not found"); - throw err; - // } catch (error) { // manually catching - // next(error); // passing to default middleware error handler - // } + // // try { + // // console.log("Async code example.") + // const err = new PageNotFoundException("verb not found"); + // throw err; + // // } catch (error) { // manually catching + // // next(error); // passing to default middleware error handler + // // } + throw new OaiModelException( + StatusCodes.INTERNAL_SERVER_ERROR, + "The verb provided in the request is illegal.", + OaiErrorCodes.BADVERB, + ); } } diff --git a/src/exceptions/OaiErrorCodes.ts b/src/exceptions/OaiErrorCodes.ts index 3cb2fd4..8361dcd 100644 --- a/src/exceptions/OaiErrorCodes.ts +++ b/src/exceptions/OaiErrorCodes.ts @@ -12,7 +12,7 @@ export enum OaiErrorCodes { // https://medium.com/@juliapassynkova/map-your-typescript-enums-e402d406b229 export const OaiModelError = new Map([ - [OaiErrorCodes.BADARGUMENT, 'badVerb'], + [OaiErrorCodes.BADVERB, 'badVerb'], [OaiErrorCodes.BADARGUMENT, 'badArgument'], [OaiErrorCodes.NORECORDSMATCH, 'noRecordsMatch'], [OaiErrorCodes.CANNOTDISSEMINATEFORMAT, 'cannotDisseminateFormat'],