- throw badVerb for oai.controller if no or bad verb is defined
This commit is contained in:
parent
69bc8e4b75
commit
9eef31fbd8
|
@ -187,13 +187,18 @@ export class OaiController {
|
||||||
this.handleIllegalVerb();
|
this.handleIllegalVerb();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// try {
|
// // try {
|
||||||
// console.log("Async code example.")
|
// // console.log("Async code example.")
|
||||||
const err = new PageNotFoundException("verb not found");
|
// const err = new PageNotFoundException("verb not found");
|
||||||
throw err;
|
// throw err;
|
||||||
// } catch (error) { // manually catching
|
// // } catch (error) { // manually catching
|
||||||
// next(error); // passing to default middleware error handler
|
// // 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,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export enum OaiErrorCodes {
|
||||||
|
|
||||||
// https://medium.com/@juliapassynkova/map-your-typescript-enums-e402d406b229
|
// https://medium.com/@juliapassynkova/map-your-typescript-enums-e402d406b229
|
||||||
export const OaiModelError = new Map<number, string>([
|
export const OaiModelError = new Map<number, string>([
|
||||||
[OaiErrorCodes.BADARGUMENT, 'badVerb'],
|
[OaiErrorCodes.BADVERB, 'badVerb'],
|
||||||
[OaiErrorCodes.BADARGUMENT, 'badArgument'],
|
[OaiErrorCodes.BADARGUMENT, 'badArgument'],
|
||||||
[OaiErrorCodes.NORECORDSMATCH, 'noRecordsMatch'],
|
[OaiErrorCodes.NORECORDSMATCH, 'noRecordsMatch'],
|
||||||
[OaiErrorCodes.CANNOTDISSEMINATEFORMAT, 'cannotDisseminateFormat'],
|
[OaiErrorCodes.CANNOTDISSEMINATEFORMAT, 'cannotDisseminateFormat'],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user