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

fix: allow snapshots in shorter transpiled files #513

Merged

Conversation

DominicKramer
Copy link
Contributor

If a source file had n lines and was transpiled to a JavaScript
file with m lines with m < n, and one tried to set a snapshot
on a line between m+1 and n in the original source file,
setting the snapshot would incorrectly fail with an error stating
that the requested line was beyond the size of the file.

Fixes: #464

If a source file had `n` lines and was transpiled to a JavaScript
file with `m` lines with `m < n`, and one tried to set a snapshot
on a line between `m+1` and `n` in the original source file,
setting the snapshot would incorrectly fail with an error stating
that the requested line was beyond the size of the file.

Fixes: googleapis#464
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 28, 2018
@DominicKramer DominicKramer requested a review from a team August 28, 2018 19:17
@@ -339,6 +324,20 @@ export class InspectorDebugApi implements debugapi.DebugApi {
column += debugapi.MODULE_WRAP_PREFIX_LENGTH - 1;
}

// TODO: Address the case where `breakpoint.location` is `null`.
// TODO: Address the case where `fileStats[matchingScript]` is `null`.
if (line >= (this.fileStats[matchingScript] as FileStats).lines) {

This comment was marked as spam.

return utils.setErrorStatusAndCallback(
cb, breakpoint, StatusMessage.BREAKPOINT_SOURCE_LOCATION,
utils.messages.INVALID_LINE_NUMBER + matchingScript + ':' +
(breakpoint.location as stackdriver.SourceLocation).line +

This comment was marked as spam.

This comment was marked as spam.

return utils.setErrorStatusAndCallback(
cb, breakpoint, StatusMessage.BREAKPOINT_SOURCE_LOCATION,
utils.messages.INVALID_LINE_NUMBER + matchingScript + ':' +
(breakpoint.location as stackdriver.SourceLocation).line +

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@soldair soldair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved with nits about the line number in the error message

@DominicKramer DominicKramer merged commit 9512bac into googleapis:master Aug 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants