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

Commit

Permalink
Report file and line number on invalid bp position
Browse files Browse the repository at this point in the history
Fixes #89
  • Loading branch information
Matt Loring committed May 18, 2016
1 parent 9c31f30 commit 222209b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/v8debugapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
V8_BREAKPOINT_MISSING: 'Internal error: V8 breakpoint missing',
V8_BREAKPOINT_DISABLED: 'Internal error: V8 breakpoint externally disabled',
CAPTURE_BREAKPOINT_DATA: 'Error trying to capture breakpoint data: ',
INVALID_LINE_NUMBER: 'Breakpoint line number is invalid'
INVALID_LINE_NUMBER: 'Invalid breakpoint position: '
};

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

// The breakpoint protobuf message presently doesn't have a column property
Expand Down
6 changes: 4 additions & 2 deletions test/test-v8debugapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ describe('v8debugapi', function() {
assert.ok(bp.status);
assert.ok(bp.status instanceof StatusMessage);
assert.ok(bp.status.isError);
assert(bp.status.description.format ===
api.messages.INVALID_LINE_NUMBER);
assert(bp.status.description.format.indexOf(
api.messages.INVALID_LINE_NUMBER) !== -1);
assert(bp.status.description.format.indexOf(
'foo.js:500') !== -1);
done();
});
});
Expand Down

0 comments on commit 222209b

Please sign in to comment.