- throw badVerb for oai.controller if no or bad verb is defined

This commit is contained in:
Arno Kaimbacher 2022-11-28 11:19:41 +01:00
parent 69bc8e4b75
commit 9eef31fbd8
2 changed files with 13 additions and 8 deletions

View File

@ -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,
);
}
}

View File

@ -12,7 +12,7 @@ export enum OaiErrorCodes {
// https://medium.com/@juliapassynkova/map-your-typescript-enums-e402d406b229
export const OaiModelError = new Map<number, string>([
[OaiErrorCodes.BADARGUMENT, 'badVerb'],
[OaiErrorCodes.BADVERB, 'badVerb'],
[OaiErrorCodes.BADARGUMENT, 'badArgument'],
[OaiErrorCodes.NORECORDSMATCH, 'noRecordsMatch'],
[OaiErrorCodes.CANNOTDISSEMINATEFORMAT, 'cannotDisseminateFormat'],