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,
|
showAndLogExceptionWithTelemetry,
|
||||||
} from "../helpers";
|
} from "../helpers";
|
||||||
import { extLogger } from "../common";
|
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 { load as loadYaml } from "js-yaml";
|
||||||
import { DatabaseItem, DatabaseManager } from "../local-databases";
|
import { DatabaseItem, DatabaseManager } from "../local-databases";
|
||||||
import { CodeQLCliServer } from "../cli";
|
import { CodeQLCliServer } from "../cli";
|
||||||
@@ -161,6 +161,10 @@ export class DataExtensionsEditorView extends AbstractWebview<
|
|||||||
|
|
||||||
protected async loadExistingModeledMethods(): Promise<void> {
|
protected async loadExistingModeledMethods(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
if (!(await pathExists(this.modelFilename))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const yaml = await readFile(this.modelFilename, "utf8");
|
const yaml = await readFile(this.modelFilename, "utf8");
|
||||||
|
|
||||||
const data = loadYaml(yaml, {
|
const data = loadYaml(yaml, {
|
||||||
|
|||||||
Reference in New Issue
Block a user