comment try catch

This commit is contained in:
Bright 2024-02-19 17:22:05 +07:00
parent 83de553692
commit a1e5bf6f5b
4 changed files with 76 additions and 76 deletions

View file

@ -81,7 +81,7 @@ export class SalaryRanksController extends Controller {
requestBody: UpdateSalaryRank,
@Request() request: { user: Record<string, any> },
) {
try {
// try {
const salaryRank = await this.salaryRankRepository.findOne({ where: { id: id } });
if (!salaryRank) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id);
@ -91,9 +91,9 @@ export class SalaryRanksController extends Controller {
this.salaryRankRepository.merge(salaryRank, requestBody);
await this.salaryRankRepository.save(salaryRank);
return new HttpSuccess();
} catch (error: any) {
throw new Error(error);
}
// } catch (error: any) {
// throw new Error(error);
// }
}
/**
@ -105,7 +105,7 @@ export class SalaryRanksController extends Controller {
*/
@Delete("{id}")
async deleteSalaryRanks(@Path() id: string) {
try {
// try {
const delSalaryRanks = await this.salaryRankRepository.findOne({
where: { id },
});
@ -114,9 +114,9 @@ export class SalaryRanksController extends Controller {
}
await this.salaryRankRepository.delete({ id: id });
return new HttpSuccess();
} catch (error: any) {
throw new Error(error);
}
// } catch (error: any) {
// throw new Error(error);
// }
}
// /**
@ -156,7 +156,7 @@ export class SalaryRanksController extends Controller {
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
try {
// try {
const [salaryRank, total] = await this.salaryRankRepository.findAndCount({
where: {
salaryId: id,
@ -197,8 +197,8 @@ export class SalaryRanksController extends Controller {
return new HttpSuccess([]);
}
return new HttpSuccess({ data: salaryRank, total });
} catch (error: any) {
throw new Error(error);
}
// } catch (error: any) {
// throw new Error(error);
// }
}
}