Handle export errors with empty scene or KCL errors (#2477)

* Update Cargo.lock

* Handle bad or empty scene export

Log error and send toast to user

* fmt
This commit is contained in:
Dan Shaw
2024-05-23 16:03:34 -07:00
committed by GitHub
parent d48eb0c66c
commit 56d930c4f2

View File

@ -300,8 +300,23 @@ export const ModelingMachineProvider = ({
selectionRanges
)
},
'Has exportable geometry': () =>
kclManager.kclErrors.length === 0 && kclManager.ast.body.length > 0,
'Has exportable geometry': () => {
if (
kclManager.kclErrors.length === 0 &&
kclManager.ast.body.length > 0
)
return true
else {
let errorMessage = 'Unable to Export '
if (kclManager.kclErrors.length > 0)
errorMessage += 'due to KCL Errors'
else if (kclManager.ast.body.length === 0)
errorMessage += 'due to Empty Scene'
console.error(errorMessage)
toast.error(errorMessage)
return false
}
},
},
services: {
'AST-undo-startSketchOn': async ({ sketchDetails }) => {