Skip to content

Commit 3f2e9fe

Browse files
authored
Revert eroneous change to JsGetAndClearExceptionWIthMetadata (#6412)
Revert an erroneous edit made to JsGetAndClearExceptionWIthMetadata. And bring behaviour of this API back inline with version 1.11. This relates to logic used for obtaining the source of the line of Js which generated the exception. This specific path is followed only when the error is on the last line of the script. In that case the line is measured by doing: Obtain offset of the start of the line (characters/bytes from start of script to beginning of erroring line) Obtain offset for end of the script (full size of script) Work out the difference between the two The error was that the output of (1) was being added to (2) - then upon working out the difference the result was always the full size of the script, not the length of the last line as wanted. Note I have not added a test case for this as it would be rather complicated and this code is only used in this API and not for any other purpose - a better mechanism for testing some of these APIs should be developed at a later date. Fix: #6408
1 parent 68263dc commit 3f2e9fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Runtime/Library/JavascriptExceptionMetadata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ namespace Js {
105105

106106
if (nextLine >= cache->GetLineCount())
107107
{
108-
endByteOffset = startByteOffset + functionBody->LengthInBytes();
109-
endCharOffset = startCharOffset + functionBody->LengthInChars();
108+
endByteOffset = functionBody->LengthInBytes();
109+
endCharOffset = functionBody->LengthInChars();
110110
}
111111
else
112112
{

0 commit comments

Comments
 (0)