Commit graph

1 commit

Author SHA1 Message Date
Abhinav Gupta
120b8c7c14 renderer: Helpful panic for unknown NodeKind
When rendering a Node, Renderer looks up the NodeRenderer for that
node's kind in a slice. That will panic with an "index out of range"
error if a node renderer for that node kind has not been registered.

    panic: runtime error: index out of range [1] with length 1

This changes Renderer to panic with a more helpful error message if the
node kind is unrecognized.

    panic: unrecognized node kind Document cannot be rendered:
    register a renderer for this node kind first
2020-03-07 08:38:51 -08:00