fixing throw HttpError

This commit is contained in:
Warunee Tamkoo 2024-09-06 09:37:29 +07:00
parent 78be6d81b2
commit 0e54b8b880
8 changed files with 90 additions and 90 deletions

View file

@ -54,7 +54,7 @@ export class EvaluateController extends Controller {
},
});
if (!director) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
}
const director_id = director.personal_id;
@ -63,7 +63,7 @@ export class EvaluateController extends Controller {
where: { id: assign_id },
});
if (!assign) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
}
const profile = await (assign.profile
@ -126,7 +126,7 @@ export class EvaluateController extends Controller {
},
});
if (!director) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
}
const director_id = director.personal_id;
let evaluate: any = null;
@ -148,14 +148,14 @@ export class EvaluateController extends Controller {
}
if (!evaluate) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
}
const assign = await this.assignRepository.findOne({
where: { id: assign_id },
});
if (!assign) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
}
// const profile = await (assign.profile
@ -241,7 +241,7 @@ export class EvaluateController extends Controller {
},
});
if (!director) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
}
const director_id = director.personal_id;
@ -251,7 +251,7 @@ export class EvaluateController extends Controller {
where: { id: assign_id },
});
if (!assign) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
}
const postData: any = await {
@ -326,7 +326,7 @@ export class EvaluateController extends Controller {
const before = evaluate;
if (!evaluate) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
}
evaluate.commander_dated = requestBody.commander_dated;