Skip to content

Convert to ES6 Class Refactoring fails with empty catch clause #18541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hbenl opened this issue Sep 18, 2017 · 0 comments · Fixed by #18547
Closed

Convert to ES6 Class Refactoring fails with empty catch clause #18541

hbenl opened this issue Sep 18, 2017 · 0 comments · Fixed by #18547
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@hbenl
Copy link

hbenl commented Sep 18, 2017

TypeScript Version: nightly (2.6.0-dev.20170916)

Try the refactoring on the following code:
Code

function MyClass() {
}
MyClass.prototype.foo = function() {
    try { doStuff(); } catch(e) {}
}

Expected behavior:
The code is refactored

Actual behavior:
Typescript throws an Error:

[Error  - 11:06:40] 'getEditsForRefactor' request failed with error.
Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at getPos (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:72918:22)
    at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73354:29)
    at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:43020:45)
    at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73342:30)
    at visitNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42792:23)
    at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:43052:43)
    at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73342:30)
    at Object.visitNodes (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42829:48)
    at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73349:30)
    at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:43020:45)
    at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73342:30)
    at visitNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42792:23)
    at visitFunctionBody (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42875:23)
    at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42914:510)
    at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73342:30)
    at Object.visitNodes (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42829:48)
    at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73349:30)
    at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:43060:355)
    at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73342:30)
    at getNonformattedText (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73318:52)
    at ChangeTracker.getFormattedTextOfNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73285:40)
    at ChangeTracker.computeNewText (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73279:33)
    at c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73254:44
    at Map.forEach (native)
    at ChangeTracker.getChanges (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73247:32)
    at Object.getEditsForAction (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:75033:42)
    at Object.getEditsForRefactor (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73512:41)
    at Object.getEditsForRefactor (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:77543:32)
    at IOSession.Session.getEditsForRefactor (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83445:59)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:82407:61)
    at c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83622:88
    at IOSession.Session.executeWithRequestId (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83613:28)
    at IOSession.Session.executeCommand (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83622:33)
    at IOSession.Session.onMessage (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83642:35)
    at Interface.<anonymous> (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:84789:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)

@Andy-MS this sounds very similar to #18437 which you fixed last week.

@mhegazy mhegazy added the Bug A bug in TypeScript label Sep 18, 2017
@mhegazy mhegazy assigned ghost Sep 18, 2017
@mhegazy mhegazy added this to the TypeScript 2.6 milestone Sep 18, 2017
@ghost ghost closed this as completed in #18547 Sep 18, 2017
@ghost ghost added the Fixed A PR has been merged for this issue label Sep 18, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants