fix(sync_shipment): 捕获运单状态更新时的异常并记录日志
添加try-catch块来捕获updateShipmentState过程中可能出现的错误 使用logger记录错误信息以便后续排查
This commit is contained in:
parent
cd0bcedfad
commit
f797950b4c
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue