Skip to content

Error when offline #30

@hzsyahzin

Description

@hzsyahzin

When offline but with "c3.lsp.checkForUpdate": true, the following error is emitted:

2025-12-14 23:09:56.900 [error] TypeError: Cannot read properties of undefined (reading 'releases')
	at BF (C:\Users\hzsyahzin\scoop\persist\vscode\data\extensions\c3.vscode-c3-0.1.9\dist\extension.js:34813:15)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async P9 (C:\Users\hzsyahzin\scoop\persist\vscode\data\extensions\c3.vscode-c3-0.1.9\dist\extension.js:34823:13)
	at async MF (C:\Users\hzsyahzin\scoop\persist\vscode\data\extensions\c3.vscode-c3-0.1.9\dist\extension.js:34801:32)

Note that the line numbers in extension.js are incorrect to the minified version, as I ran the file through a beautifier.

Looking at the file, this error is possibly due to the fact that it pings the LSP in the BF() function, and when offline, doesn't seem to catch the error. The relevant code section is here:

async function BF() {
    let t;
    try {
        t = (await Ho.get("https://pherrymason.github.io/c3-lsp/releases.json")).data
    } catch (n) {
        console.log("Error: ", n)
    }
    let e = t.releases.sort((n, r) => n.version > r.version)[0];
    return {
        version: new yp.default.SemVer(e.version),
        artifacts: e.artifacts
    }
}

Note that this is in spite of the fact that I have c3-lsp locally downloaded. This is presumably because it is checking for an update as stated above, as this error does not occur when "c3.lsp.checkForUpdate": false.

Apologies, but I am not familiar enough with JS or vscode extensions to provide a suggestion on a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions