observablehq / observablehq/runtime
Cell level error handling
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 87
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
Hello,
When the evaluation of a cell throws an exception, the variable that was to be assigned the value becomes unavailable to subsequent calls, and all cells that reference that variables are now marked as error.
This is a problem when you have cases like this:
a = ... something that throws
b = ... something that doesn't throw
c = testThatsFalse ? a : b
It'd be better that c works.
I suggest that if the evaluation of a fails, a gets assigned an 'Error' type value, which can then be further processed. As in c = isError(a) ? b : a.
Happy to work on a PR if you think this could be a good idea.
This obviously would impact the way the minimap works, but I don't think there's a case where old notebooks would suffer from this change.
It's a one-way change though...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how cell evaluation failures make assigned variables unavailable, then examine the minimap behavior mentioned in the issue. Define how an Error value should propagate through conditional expressions and how existing notebooks and minimap state should behave before implementing and testing the design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100