Skip to content

Commit b5e6700

Browse files
author
Dave Bartolomeo
committed
Log message on failure to open sourcemap
1 parent 7f5302d commit b5e6700

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

extensions/ql-vscode/src/log-insights/summary-language-support.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RawSourceMap, SourceMapConsumer } from 'source-map';
33
import { commands, Position, Selection, TextDocument, TextEditor, TextEditorRevealType, TextEditorSelectionChangeEvent, ViewColumn, window, workspace } from 'vscode';
44
import { DisposableObject } from '../pure/disposable-object';
55
import { commandRunner } from '../commandRunner';
6+
import { logger } from '../logging';
67

78
/** A `Position` within a specified file on disk. */
89
interface PositionInFile {
@@ -79,8 +80,13 @@ export class SummaryLanguageSupport extends DisposableObject {
7980
const sourceMapText = await fs.readFile(mapPath, 'utf-8');
8081
const rawMap: RawSourceMap = JSON.parse(sourceMapText);
8182
this.sourceMap = await new SourceMapConsumer(rawMap);
82-
} catch {
83-
// Error reading sourcemap. Pretend there was no sourcemap
83+
} catch (e: unknown) {
84+
// Error reading sourcemap. Pretend there was no sourcemap.
85+
if (e instanceof Error) {
86+
void logger.log(`Error reading sourcemap file '${mapPath}': ${e.message}`);
87+
} else {
88+
void logger.log(`Error reading sourcemap file '${mapPath}'`);
89+
}
8490
this.sourceMap = undefined;
8591
}
8692
this.lastDocument = document;

0 commit comments

Comments
 (0)