Stack traces for contextual/layout errors
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 56.1k
- Forks
- 1.7k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 22
Description
Description
Currently, errors that happen during evaluation show a stack trace, but errors that happen in user code during rendering (using functions such as cite or locate) do not.
Improving this would require storing a stack trace for each content node that can fail to render.
Whenever an error occurs during evaluation, the error message should show a stack trace showing the calls that led to this error. To minimize screen space usage, each entry should consist of a single line: at <function name> (<file>:<line>:<col>).
Currently, Vm doesn’t keep track of the information needed to generate a stack trace. We could make it do so using one of the following methods:
renameVmtoFrameand makeVma stack ofFrames, plus aVec<StackTraceEntry>that is pushed and popped on function calls and returnsadd aRefCell<Vec<StackTraceEntry>>field toVmadd anArc<StackTrace>field toVm, whereStackTracestores aStackTraceEntryfor the current frame and anOption<Arc<StackTrace>>for the rest of the trace. This makes the trace a linked list with shared nodes, which requires some pointer chasing to traverse but incurs less cost than the other approaches to store these traces inContentnodes (see below).
Use Case
Make it easier to debug these types of errors.
Related issues: #1702
Possible drawbacks:
- adds extra complexity
- incurs extra overhead
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 locating Vm, Content nodes, and the rendering paths for functions such as cite or locate. Compare the proposed stack-trace storage approaches and related issue #1702; done means errors from user code during rendering display a useful call stack while accounting for the stated complexity and overhead concerns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100