How should I get the error message

import { syntaxTree } from "@codemirror/language";
import { linter, type Diagnostic } from "@codemirror/lint";
const ipfLinter = linter((view) => {
    const diagnostics: Diagnostic[] = [];
    if(view.state.doc['text'][0].trim() === '') {
        return;
    }
    console.log(syntaxTree(view.state))
    syntaxTree(view.state)
        .cursor()
        .iterate((node) => {
            if (node.type.isError) {
                diagnostics.push({
                    from: node.node.parent.from,
                    to: node.node.parent.to,
                    severity: "warning",
                    message: "Error",
                });
            }
        });
    return diagnostics;
});

I know there’s an error here when ‘node.type.isError === true’ but don’t know why it’s happening.
How should I get the error message

There is no error message. Lezer trees just have these markers where they corrected some parse failure, they don’t generate or store messages.

Thanks Reply!
Is there any way to get these error messages, because I need to provide users with error reasons and suggestions for modification :smiley: