Skip to content

Commit f684761

Browse files
committed
fix: try lookup with different bias before fallback
1 parent 9b41467 commit f684761

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

packages/dev-server/src/plugins/symbolicate/Symbolicator.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,23 @@ export class Symbolicator {
162162
};
163163
}
164164

165-
const lookup = consumer.originalPositionFor({
165+
let lookup = consumer.originalPositionFor({
166166
line: frame.lineNumber,
167167
column: frame.column,
168168
bias: SourceMapConsumer.LEAST_UPPER_BOUND,
169169
});
170170

171-
// If lookup fails, we get the same shape object, but with
172-
// all values set to null
173171
if (!lookup.source) {
174-
// It is better to gracefully return the original frame
175-
// than to throw an exception
172+
// fallback to GREATEST_LOWER_BOUND
173+
lookup = consumer.originalPositionFor({
174+
line: frame.lineNumber,
175+
column: frame.column,
176+
bias: SourceMapConsumer.GREATEST_LOWER_BOUND,
177+
});
178+
}
179+
180+
// return the original frame when both lookups fail
181+
if (!lookup.source) {
176182
return {
177183
...frame,
178184
collapse: false,

0 commit comments

Comments
 (0)