Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async refresh (): Promise {
this.checkingForUpdates = true;
this._onDidChangeTreeData.fire();
try {
this.updates = await updates.checkAllUpdates();
} catch (error) {
let message = 'Failed to check for updates';
// Need to check in string as titaniumlib currently returns a string as the error
if (error.code === 'ENOTFOUND' || /ENOTFOUND/.test(error)) {
message = `${message} as you are offline`;
}
await vscode.window.showErrorMessage(message);
}
this.checkingForUpdates = false;
this._onDidChangeTreeData.fire();
if (this.updates.length) {
ExtensionContainer.context.globalState.update(GlobalState.HasUpdates, true);
vscode.commands.executeCommand('setContext', GlobalState.HasUpdates, true);
}
}