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

@ -51,7 +51,7 @@ export class DataOptionController extends Controller {
});
if (!person) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
}
let result = await this.mapKnowledgeSkillRepository.findOne({
@ -73,7 +73,7 @@ export class DataOptionController extends Controller {
}
if (!result) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลความรู้ที่ตรงกับตำแหน่ง");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลความรู้ที่ตรงกับตำแหน่ง");
}
const knowledges = await this.knowledgeRepository.find({
@ -112,7 +112,7 @@ export class DataOptionController extends Controller {
});
if (!person) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
let result = await this.mapKnowledgeSkillRepository.findOne({
@ -146,7 +146,7 @@ export class DataOptionController extends Controller {
}
if (!result) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะที่ตรงกับตำแหน่ง");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะที่ตรงกับตำแหน่ง");
}
const computerData = await this.skillRepository.findOne({
@ -154,7 +154,7 @@ export class DataOptionController extends Controller {
});
if (!computerData) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะคอมพิวเตอร์");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะคอมพิวเตอร์");
}
const computer = await {
id: computerData.id,
@ -177,7 +177,7 @@ export class DataOptionController extends Controller {
});
if (!englishData) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะภาษาอังกฤษ");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทักษะภาษาอังกฤษ");
}
const english = await {
@ -201,7 +201,7 @@ export class DataOptionController extends Controller {
});
if (!informationData) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const information = await {
@ -224,7 +224,7 @@ export class DataOptionController extends Controller {
where: { type: TypeSkill.RESOURSE, active: 1 },
});
if (!resourseData) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const resourse = await {
@ -267,7 +267,7 @@ export class DataOptionController extends Controller {
});
if (!results) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const result = await results.map((v) => ({
@ -306,7 +306,7 @@ export class DataOptionController extends Controller {
});
if (!person) {
return new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const assign = await this.assignRepository.count({