zksu
/
API
forked from yoone/API
1
0
Fork 0

fix(sync_shipment): 捕获运单状态更新时的异常并记录日志

添加try-catch块来捕获updateShipmentState过程中可能出现的错误
使用logger记录错误信息以便后续排查
This commit is contained in:
tikkhun 2026-01-08 16:08:41 +08:00
parent cd0bcedfad
commit f797950b4c
1 changed files with 8 additions and 4 deletions

View File

@ -75,10 +75,14 @@ export class SyncUniuniShipmentJob implements IJob{
'255': 'Gateway_To_Gateway_Transit'
};
async onTick() {
const shipments:Shipment[] = await this.shipmentModel.findBy({ finished: false });
shipments.forEach(shipment => {
this.logisticsService.updateShipmentState(shipment);
});
try {
const shipments:Shipment[] = await this.shipmentModel.findBy({ finished: false });
shipments.forEach(shipment => {
this.logisticsService.updateShipmentState(shipment);
});
} catch (error) {
this.logger.error(`更新运单状态失败 ${error.message}`);
}
}
onComplete(result: any) {