throw a new `Error` if `supportedNodeTypes` is wrong