🐽 Makes model-loading use result type for error handling

This commit is contained in:
Rune Harlyk
2024-02-23 00:59:43 +01:00
parent 1f8d753dd7
commit e7788fb3a0
2 changed files with 14 additions and 7 deletions
+9 -3
View File
@@ -15,9 +15,15 @@
onMount(async () => {
socketService.connect(socketLocation);
registerFetchIntercept()
const [urdf, JOINT_NAME] = await loadModelAsync('/spot_micro.urdf.xacro')
jointNames.set(JOINT_NAME)
model.set(urdf)
const modelRes = await loadModelAsync('/spot_micro.urdf.xacro')
if (modelRes.isOk()) {
const [urdf, JOINT_NAME] = modelRes.inner
jointNames.set(JOINT_NAME)
model.set(urdf)
} else {
console.error(modelRes.inner, {"exception": modelRes.exception})
}
});
const registerFetchIntercept = () => {