You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError: Cannot read properties of undefined (reading 'slice')
at parsePathFromFirstLine (node_modules/gitdiff-parser/index.js:21:35)
Context
It started happening after upgrading our app package to version 0.3.1 and I believe the issue started happening after this commit has been merged. The lines causing the error are highlighted.
The text was updated successfully, but these errors were encountered:
Expected Behavior
Should parse the diff without any errors or handle the errors gracefully.
Current Behavior
Throws an error when the diff is incorrect
Possible Solution
Check if the string is defined before accessing the
.slice
method.Steps to Reproduce
gitDiffParser.parse
method'diff --git \nindex 9c96b34..853bddf 100644\n---@@ -1,8 +1,19 @@\n-// write your code here!\n const solution = () => {\n- // global clear all timeout:\n+ const allT = [];\n+ const old = setTimeout;\n+ window.setTimeout = (func, delay) => {\n+ const realTimeout = old(func, delay);\n+ allT.push(realTimeout);\n+ return realTimeout;\n+ };\n+ window.clearAllTimouts = () => {\n+ while (allT.length) {\n+ clearTimeout(allT.pop());\n+ }\n+ };\n cat = () => {\n- }\n+ window.clearAllTimouts();\n+ };\n };\n \n module.exports = solution;'
It will throw:
Context
It started happening after upgrading our app package to version
0.3.1
and I believe the issue started happening after this commit has been merged. The lines causing the error are highlighted.The text was updated successfully, but these errors were encountered: