david-yz-liu / memory-viz

Javascript library for creating beginner-friendly memory model diagrams.
https://www.cs.toronto.edu/~david/memory-viz/demo/
2 stars 7 forks source link

Add validation for MemoryViz compatible JSON #97

Open leowrites opened 4 days ago

leowrites commented 4 days ago

When using MemoryViz with an incompatible JSON, such as when a field is missing, MemoryViz may crash.

In this example, type is missing

[{
    id: 19,
    value: "type is missing",
    style: ["highlight"],
}]

It would be nice if there are validations to handle these cases and give more descriptive error messages, such as: Error: "type" is missing while drawing a primitive object.