Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad sketches dont block run #471

Conversation

cale-bradbury
Copy link
Contributor

I had a sketch that was now failing due to the removal of THREE.GLTFLoader, that said, there could be any number of things that break a sketch.

This change continues with the initialization so you can at least load sketches that did init properly.

The sketch that failed does not appear in the list of sketches you can add.

This might leave an issue when opening a project that wants to use an uninitialized sketch due to bad changes, but I doubt it would break any worse than failing to init the three scene

@funwithtriangles
Copy link
Member

Thanks for this, clearly an important topic that needed to be addressed. I was looking at the code and realised that it probably makes more sense to handle this at the lowest level possible, so that we're catching this when sketches are refreshed on code changes, not just when loaded on init.

I ended up in a little rabbit hole but I think the result is quite nice. We now explicitly return a Result object when importing sketches, with a success boolean flag. Functions higher up can decide what to do with that (e.g. later we'll want to do something with the UI to explain an error).

Comment on lines +69 to +71
if (!result.success) {
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we're now checking for this issue lower down, other functions are affected. Here we're just not doing the reimport stuff if the module failed to load.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this looks really nice, feel free to merge :)

@funwithtriangles funwithtriangles merged commit 7e98aad into nudibranchrecords:alpha Dec 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants