Skip to content
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

Catch clause identifier cannot be watched in async function #68801

Closed
kkeri opened this issue Feb 15, 2019 · 2 comments
Closed

Catch clause identifier cannot be watched in async function #68801

kkeri opened this issue Feb 15, 2019 · 2 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@kkeri
Copy link

kkeri commented Feb 15, 2019

Issue Type: Bug

Steps to reproduce:

  1. Copy the following code into test.ts.
async function catches (f) {
  try {
    await f()
  }
  catch (e) {
    console.error(e)
  }
}
catches(() => { throw new Error() })
  1. Transpile the code for ES5 target. (I used Typescript version 3.3.3)
  2. Set breakpoint on the console.error(e) line.
  3. Launch program, let the debugger pause at the breakpoint.

Expected behavior: if I move the cursor over the identifier e, or add a new watch, I see the value of e.

Actual behavior: I can't see the value of e. If I try to add a watch, I get e: not available.

Notes:

  • If I remove await from the code, the issue doesn't occur.
  • If I add watch for the identifier e_1 instead e, it works. The obvious reason is being the compiler has changed the variable name. See the relevant part of the transpiled file:
function catches(f) {
    return __awaiter(this, void 0, void 0, function () {
        var e_1;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    _a.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, f()];
                case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                case 2:
                    e_1 = _a.sent();
                    console.error(e_1);
                    return [3 /*break*/, 3];
                case 3: return [2 /*return*/];
            }
        });
    });
}

VS Code version: Code 1.31.1 (1b8e830, 2019-02-12T02:20:54.427Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs AMD FX(tm)-4100 Quad-Core Processor (4 x 3607)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 7.73GB (2.44GB free)
Process Argv --disable-extensions
Screen Reader no
VM 0%
Extensions disabled
@vscodebot vscodebot bot removed the new release label Feb 17, 2019
@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label Feb 17, 2019
@roblourens
Copy link
Member

#12066

@vscodebot
Copy link

vscodebot bot commented Feb 17, 2019

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants