question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't catch exceptions when running in the debugger, but do catch them otherwise?

See original GitHub issue

Checklist

Is your feature request related to a problem? Please describe. We love your test adapter and use it often. A typical use case is:

  • execute the tests (GTEST_CATCH_EXCEPTIONS=1)
  • check which tests fail
  • execute the failing tests in the debugger (GTEST_CATCH_EXCEPTIONS=0)

To do this, we currently have to change GTEST_CATCH_EXCEPTIONS between “normal” test runs and debugger test runs. We do that in .vscode/settings.json but its not very convenient:

    "testMate.cpp.test.advancedExecutables": [
        {
            "name": "${filename}",
            "description": "(Test)",
            "cwd": "${absDirpath}",
            "env": {
                "GTEST_CATCH_EXCEPTIONS" : "0"
            }
        }

Describe the solution you’d like It would be great if this use case could be supported more “automatic”. For example, there could be different environment settings when using the debugger versus when not using the debugger?

Describe alternatives you’ve considered I tried to override GTEST_CATCH_EXCEPTIONS in testMate.cpp.debug.configTemplate. But I do not understand how I can append to the environment variables. I need to append so that the rest of the environment is correctly inherited. There are the esttings "env": "${envObj}" and "environment": "${envObjArray}". How could I append or override GTEST_CATCH_EXCEPTIONS in these settings? I could not get something like the following to work:

"env": {
    "${envObj}",
    "GTEST_CATCH_EXCEPTIONS=0"
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
matepekcommented, Oct 1, 2021
0reactions
matepekcommented, Oct 1, 2021

Note for the seeker

This can come from launch.json too. So if you have a config in launch.json which is recognized by the extension then "testMate.cpp.debug.setEnv" can be added there too and should work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Catch exception if debugger is not attached - Stack Overflow
I have considered inline IL as an option to generate the conditional exception, but this requires post-build steps with 3rd party tools. I...
Read more >
Manage exceptions with the debugger in Visual Studio
Learn how to specify which exceptions the debugger breaks on, at which point you want the debugger to break, and how breaks are...
Read more >
Don't catch exceptions when debugging. · Issue #12 - GitHub
When debugging, the debugger normally breaks on an uncaught exception. But the PSharp runtime catches all exceptions, reports the stack ...
Read more >
Exceptions and debugging - Advanced R. - Hadley Wickham
This chapter will teach you how to fix unanticipated problems (debugging), show you how functions can communicate problems and how you can take...
Read more >
Error handling, "try...catch" - The Modern JavaScript Tutorial
So, try...catch can only handle errors that occur in valid code. Such errors are called “runtime errors” or, sometimes, “exceptions”.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found