Merge pull request #2337 from github/koesie10/fix-not-exists-error
Fix error when model file does not exist
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
} from "../helpers";
|
||||
import { extLogger } from "../common";
|
||||
import { outputFile, readFile } from "fs-extra";
|
||||
import { outputFile, pathExists, readFile } from "fs-extra";
|
||||
import { load as loadYaml } from "js-yaml";
|
||||
import { DatabaseItem, DatabaseManager } from "../local-databases";
|
||||
import { CodeQLCliServer } from "../cli";
|
||||
@@ -161,6 +161,10 @@ export class DataExtensionsEditorView extends AbstractWebview<
|
||||
|
||||
protected async loadExistingModeledMethods(): Promise<void> {
|
||||
try {
|
||||
if (!(await pathExists(this.modelFilename))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const yaml = await readFile(this.modelFilename, "utf8");
|
||||
|
||||
const data = loadYaml(yaml, {
|
||||
|
||||
Reference in New Issue
Block a user