Proposal
Add a refactoring that can surround a statement with a try/catch block or potentially other blocks
For example:
class Ranger {
rick(count: number, precision: number) {
let result = 'r'
for (let i = 0; i < count; ++i)
result += i.toPrecision(precision)
return result
}
}
new Ranger().rick(2, -1)
if a user selects the for block and did a surround with try/catch refactoring, the result would be:
class Ranger {
rick(count: number, precision: number) {
let result = 'r'
try {
for (let i = 0; i < count; ++i)
result += i.toPrecision(precision)
} catch (e) {
}
return result
}
}
new Ranger().rick(2, -1)
Proposal
Add a refactoring that can surround a statement with a try/catch block or potentially other blocks
For example:
if a user selects the
forblock and did asurround with try/catchrefactoring, the result would be: