Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 222209b

Browse files
author
Matt Loring
committed
Report file and line number on invalid bp position
Fixes #89
1 parent 9c31f30 commit 222209b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/v8debugapi.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
V8_BREAKPOINT_MISSING: 'Internal error: V8 breakpoint missing',
4343
V8_BREAKPOINT_DISABLED: 'Internal error: V8 breakpoint externally disabled',
4444
CAPTURE_BREAKPOINT_DATA: 'Error trying to capture breakpoint data: ',
45-
INVALID_LINE_NUMBER: 'Breakpoint line number is invalid'
45+
INVALID_LINE_NUMBER: 'Invalid breakpoint position: '
4646
};
4747

4848
/** @const */ var MODULE_WRAP_PREFIX_LENGTH = require('module').wrap('☃')
@@ -267,7 +267,11 @@ module.exports.create = function(logger_, config_, fileStats_) {
267267
if (breakpoint.location.line >= fileStats[matchingScript].lines) {
268268
return setErrorStatusAndCallback(cb, breakpoint,
269269
StatusMessage.BREAKPOINT_SOURCE_LOCATION,
270-
messages.INVALID_LINE_NUMBER);
270+
messages.INVALID_LINE_NUMBER + matchingScript + ':' +
271+
breakpoint.location.line + '. Loaded script contained ' +
272+
fileStats[matchingScript].lines + ' lines. Please ensure' +
273+
' that the breakpoint was set in the same code version as the' +
274+
' deployed source.');
271275
}
272276

273277
// The breakpoint protobuf message presently doesn't have a column property

test/test-v8debugapi.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ describe('v8debugapi', function() {
247247
assert.ok(bp.status);
248248
assert.ok(bp.status instanceof StatusMessage);
249249
assert.ok(bp.status.isError);
250-
assert(bp.status.description.format ===
251-
api.messages.INVALID_LINE_NUMBER);
250+
assert(bp.status.description.format.indexOf(
251+
api.messages.INVALID_LINE_NUMBER) !== -1);
252+
assert(bp.status.description.format.indexOf(
253+
'foo.js:500') !== -1);
252254
done();
253255
});
254256
});

0 commit comments

Comments
 (0)