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

Allow specific cells to contain errors #170

Open
MichaelHatherly opened this issue Sep 22, 2023 · 5 comments
Open

Allow specific cells to contain errors #170

MichaelHatherly opened this issue Sep 22, 2023 · 5 comments

Comments

@MichaelHatherly
Copy link
Collaborator

I've got some notebooks that intentionally have errors in specific cells for teaching purposes.

It would be great if there was a way to mark these cells as "expected errors" and just render the error in the output instead of stopping the notebook build with an error.

We've got a custom patched version of PlutoSliderServer which allows for specifying a list of cell UUIDs that we expect to have errors in, and any that error that aren't in that list cause the build to fail. Doing something similar could work here too, but would like your feedback @rikhuijzer for other potential solutions?

@rikhuijzer
Copy link
Owner

I’m don’t currently have a computer at hand, but have you seen #73? That might be related.

@MichaelHatherly
Copy link
Collaborator Author

Ah, yes, related. That's an option for us, though it does clutter up the notebook file itself for any users that are running it themselves.

@rikhuijzer
Copy link
Owner

Yeah I get that. Can you suggest how you would like the API to be?

@MichaelHatherly
Copy link
Collaborator Author

Can you suggest how you would like the API to be?

The API we've been using in our patched sliderserver is to pass a Dict of filename mapping to a list of UUIDs where we expect errors. E.g.

expected_errors = Dict(
    "1.jl" => [
        Base.UUID("fdee78e2-5932-11ee-2841-4b729906916f"),
    ],
    "subdir/2.jl" => [
        Base.UUID("1dee78e2-5932-11ee-2841-4b729906916a"),
    ]
)

and pass that as a keyword to the builder function.

It's not terribly elegant, granted.

@rikhuijzer
Copy link
Owner

Yes agreed on not so elegant, but I also cannot come up with something better. Can you make a PR? I’m okay with this API and would be happy to merge a PR

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

No branches or pull requests

2 participants