comment try catch
This commit is contained in:
parent
83de553692
commit
a1e5bf6f5b
4 changed files with 76 additions and 76 deletions
|
|
@ -85,16 +85,16 @@ export class PosLevelController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. posLevelAuthority");
|
||||
}
|
||||
|
||||
try {
|
||||
// try {
|
||||
posLevel.createdUserId = request.user.sub;
|
||||
posLevel.createdFullName = request.user.name;
|
||||
posLevel.lastUpdateUserId = request.user.sub;
|
||||
posLevel.lastUpdateFullName = request.user.name;
|
||||
await this.posLevelRepository.save(posLevel);
|
||||
return new HttpSuccess(posLevel);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,15 +144,15 @@ export class PosLevelController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. posLevelAuthority");
|
||||
}
|
||||
|
||||
try {
|
||||
// try {
|
||||
posLevel.lastUpdateUserId = request.user.sub;
|
||||
posLevel.lastUpdateFullName = request.user.name;
|
||||
this.posLevelRepository.merge(posLevel, requestBody);
|
||||
await this.posLevelRepository.save(posLevel);
|
||||
return new HttpSuccess(posLevel.id);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -168,12 +168,12 @@ export class PosLevelController extends Controller {
|
|||
if (!delPosLevel) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id);
|
||||
}
|
||||
try {
|
||||
// try {
|
||||
await this.posLevelRepository.remove(delPosLevel);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,7 +198,7 @@ export class PosLevelController extends Controller {
|
|||
},
|
||||
)
|
||||
async GetLevelDetail(@Path() id: string) {
|
||||
try {
|
||||
// try {
|
||||
const getPosType = await this.posLevelRepository.findOne({
|
||||
select: ["id", "posLevelName", "posLevelRank", "posLevelAuthority"],
|
||||
relations: ["posType"],
|
||||
|
|
@ -221,9 +221,9 @@ export class PosLevelController extends Controller {
|
|||
}
|
||||
|
||||
return new HttpSuccess(mapPosLevel);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -247,7 +247,7 @@ export class PosLevelController extends Controller {
|
|||
},
|
||||
])
|
||||
async GetPosLevel() {
|
||||
try {
|
||||
// try {
|
||||
const posLevel = await this.posLevelRepository.find({
|
||||
select: ["id", "posLevelName", "posLevelRank", "posLevelAuthority", "posTypeId"],
|
||||
relations: ["posType"],
|
||||
|
|
@ -267,8 +267,8 @@ export class PosLevelController extends Controller {
|
|||
}
|
||||
}));
|
||||
return new HttpSuccess(mapPosLevel);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue