Skip to content

Commit 38d5e5c

Browse files
committed
Fixing contract create device error
1 parent f85f269 commit 38d5e5c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

backend/src/modules/smartcontract/controller/contract.controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ export class contractController {
4646
private readonly userService?: UserService,
4747
) {
4848
setTimeout(() => {
49-
this.contractService.syncAllServices();
49+
try {
50+
this.contractService.syncAllServices();
5051
this.contractService.syncAllDevices();
52+
} catch (error) {
53+
console.log("contractController constructor error:", error)
54+
}
5155
}, 4000);
5256
}
5357

backend/src/modules/smartcontract/services/contract.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,11 @@ export class ContractService {
479479
updateDate: new Date(String(contractDevices[10])),
480480
};
481481

482-
this.deviceService.insertDevice(newDevice);
482+
this.deviceService.insertDevice(newDevice)
483+
.catch(error => {
484+
console.log('syncAllDevices insertDevice error:', error);
485+
});
486+
483487
}
484488
});
485489
}

0 commit comments

Comments
 (0)