@@ -11,10 +11,15 @@ import { qlpackOfDatabase } from "../contextual/queryResolver";
1111import { file } from "tmp-promise" ;
1212import { writeFile } from "fs-extra" ;
1313import { dump } from "js-yaml" ;
14- import { getOnDiskWorkspaceFolders } from "../helpers" ;
14+ import {
15+ getOnDiskWorkspaceFolders ,
16+ showAndLogExceptionWithTelemetry ,
17+ } from "../helpers" ;
1518import { DatabaseItem } from "../local-databases" ;
1619import { CodeQLCliServer } from "../cli" ;
1720import { decodeBqrsToExternalApiUsages } from "./bqrs" ;
21+ import { redactableError } from "../pure/errors" ;
22+ import { asError , getErrorMessage } from "../pure/helpers-pure" ;
1823
1924export class DataExtensionsEditorView extends AbstractWebview <
2025 ToDataExtensionsEditorMessage ,
@@ -71,40 +76,48 @@ export class DataExtensionsEditorView extends AbstractWebview<
7176 }
7277
7378 protected async loadExternalApiUsages ( ) : Promise < void > {
74- const queryResult = await this . runQuery ( ) ;
75- if ( ! queryResult ) {
76- await this . clearProgress ( ) ;
77- return ;
78- }
79-
80- await this . showProgress ( {
81- message : "Loading results" ,
82- step : 1100 ,
83- maxStep : 1500 ,
84- } ) ;
79+ try {
80+ const queryResult = await this . runQuery ( ) ;
81+ if ( ! queryResult ) {
82+ await this . clearProgress ( ) ;
83+ return ;
84+ }
85+
86+ await this . showProgress ( {
87+ message : "Loading results" ,
88+ step : 1100 ,
89+ maxStep : 1500 ,
90+ } ) ;
8591
86- const bqrsPath = queryResult . outputDir . bqrsPath ;
92+ const bqrsPath = queryResult . outputDir . bqrsPath ;
8793
88- const bqrsChunk = await this . getResults ( bqrsPath ) ;
89- if ( ! bqrsChunk ) {
90- await this . clearProgress ( ) ;
91- return ;
92- }
94+ const bqrsChunk = await this . getResults ( bqrsPath ) ;
95+ if ( ! bqrsChunk ) {
96+ await this . clearProgress ( ) ;
97+ return ;
98+ }
9399
94- await this . showProgress ( {
95- message : "Finalizing results" ,
96- step : 1450 ,
97- maxStep : 1500 ,
98- } ) ;
100+ await this . showProgress ( {
101+ message : "Finalizing results" ,
102+ step : 1450 ,
103+ maxStep : 1500 ,
104+ } ) ;
99105
100- const externalApiUsages = decodeBqrsToExternalApiUsages ( bqrsChunk ) ;
106+ const externalApiUsages = decodeBqrsToExternalApiUsages ( bqrsChunk ) ;
101107
102- await this . postMessage ( {
103- t : "setExternalApiUsages" ,
104- externalApiUsages,
105- } ) ;
108+ await this . postMessage ( {
109+ t : "setExternalApiUsages" ,
110+ externalApiUsages,
111+ } ) ;
106112
107- await this . clearProgress ( ) ;
113+ await this . clearProgress ( ) ;
114+ } catch ( err ) {
115+ void showAndLogExceptionWithTelemetry (
116+ redactableError (
117+ asError ( err ) ,
118+ ) `Failed to load external APi usages: ${ getErrorMessage ( err ) } ` ,
119+ ) ;
120+ }
108121 }
109122
110123 private async runQuery ( ) : Promise < CoreCompletedQuery | undefined > {
0 commit comments