why does vscode catching exception nested in try except? - vscode-debugger

why does my vscode debugger caught exception when it is nested under "try-except"?
raised exception img
import inside try except
call stack
breakpoint conditions
can anyone please make some reasoning here?
the code is under try-except. so why would this happen?
thx in advance

Related

COM method returning HRESULT value 0x80070057

I'm running the VS project(which is developed with VS 2015) accompanied with Introduction to 3D Game Programming with DirectX 12 in VS 2019.
But it threw an exception with a HRESULT value of -2147024809 like this:
mCommandList->Close() failed in
E:\programs\cpp_codes\d3d12\Common\d3dApp.cpp;line 213; HRESULT:-2147024809
-2147024809 Indicates that the arguments are not correct. But as it is seen there is not any bit of argument passed to ID3D12GraphicsCommandList::Close() method, which confused me badly.
This line of code threw no exception months ago.
Another COM method threw similar exception in d3dApp.cpp, which is
ThrowIfFailed(md3dDevice->CreateCommittedResource(
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
D3D12_HEAP_FLAG_NONE,
&depthStencilDesc,
D3D12_RESOURCE_STATE_COMMON,
&optClear,
IID_PPV_ARGS(mDepthStencilBuffer.GetAddressOf()))); failed in
E:\programs\cpp_codes\d3d12\Common\d3dApp.cpp;line 203; HRESULT:-2147024809
But as long as I changed the fifth argument from &optClear into nullptr, this exception stops from showing up. Also, this invocation of CreateCommittedResource threw no exception months ago.
I think it is because there is a mismatch in clear color variable, try to set same clear color in all the clearColor variable usage ...
Comments below my question suggested that debug layer will best help in such condition. What I actually did was clicking Debug->Graphics->Start Graphics Debugging in the menu bar of Visual Studio 2019. And then, detailed debug information showed up in the output window of Visual Studio 2019, it ran D3D12 ERROR: ID3D12Device::CreateCommittedResource: pOptimizedClearValue must be NULL when D3D12_RESOURCE_DESC::Dimension is not D3D12_RESOURCE_DIMENSION_BUFFER and neither D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET nor D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL are set in D3D12_RESOURCE_DESC::Flags. [ STATE_CREATION ERROR #815: CREATERESOURCE_INVALIDCLEARVALUE].
So this is the point, because I had set D3D12_RESOURCE_FLAG_NONE in D3D12_RESOURCE_DESC::Flags.
It's no wonder that this exception stopped from being thrown by CreateCommittedResource after I passed nullptr to the fifth parameter of CreateCommittedResource. After I had set D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL, everything behaves well without any exception thrown.
And this is the code snippet ran into problem:
D3D12_RESOURCE_DESC depthStencilDesc;
depthStencilDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
//Assignments to other members of depthStencilDesc
//This line caused the problem.
depthStencilDesc.Flags = D3D12_RESOURCE_FLAG_NONE;
D3D12_CLEAR_VALUE optClear;
//Assignments to the members of optClear
ThrowIfFailed(md3dDevice->CreateCommittedResource(
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
D3D12_HEAP_FLAG_NONE,
&depthStencilDesc,
D3D12_RESOURCE_STATE_COMMON,
&optClear,
IID_PPV_ARGS(mDepthStencilBuffer.GetAddressOf())));

SignalFx: Report a rescued exception in Ruby code, similar to NewRelic::Agent.notice_error?

In a Ruby on Rails app, I rescue an exception in a known scenario. In the rescue, my code does a little clean up then moves on without re-raising the exception.
I want to log details of the exception to SignalFx. I believe this happens automatically if the exception is not rescued. But in this case I need to rescue it.
We are currently migrating from New Relic to SignalFx. In New Relic, I could force the rescued exception to be logged like this:
rescue MySpecialError => ex
NewRelic::Agent.notice_error ex
record.clean_up_after_my_special_error()
This would record the stack trace, request params, env vars, etc, exactly as if the exception was not rescued.
Is there a similar way with SignalFx to capture rich exception information without raising the exception?
According to the docs,
client = SignalFx.new 'MY_SIGNALFX_TOKEN'
client.send_event('EXCEPTION', ... )
You may want to consider using a more focused error-reporting service.

Hitting exception when using Google Protobuf Any UnpackTo function in C++

google::protobuf::Any anyResponse = someResponse.response();
ResponseType unpackResp; //ResponseType is a subclass of google::protobuf::Message
if (anyResponse.UnpackTo(&unpackResp))
{
...
}
Running this piece of C++ code and access vialotion exception happens in anyResponse.UnpackTo(&unpackResp). Does someone know how to debug into this function? I checked anyResponse and it looks good.
It went through these files in google::protobuf:
call stack
Anyway I can see these files?

How to see exception info while debugging without declaring "ex" variable

While debugging, I've always been able to see information about the exception once a catch block was entered even if my catch just looked like this:
catch
{
}
Since updating to Visual Studio 2017 though, I am only able to get exception information if I've actually declared a variable like so:
catch (Exception ex)
{
}
This is super annoying because there are a number of places where the exception is not declared (and normally does not need to be) but I do need to see what the exception is while debugging if there is one. How can I get the behavior back where it always shows me about the exception regardless of whether I've declared a variable for it or not?
In the locals window you should see a pseudo variable $exception that has the exception object for you to inspect. You can also add a watch expression for $exception in any of the watch windows.
Docs with more info and other pseudovariables is at: https://learn.microsoft.com/en-us/visualstudio/debugger/pseudovariables?view=vs-2017

How to catch Exception in split-join catchAll on OSB?

I want to catch exception in split join but the fault variable is empty and it is not showing any exception .
Kindly give me any solution so I can catch and log it.
Regards,
Junaid
It's hard to do easily. That's why I use Generic Parallel and let it do the hard work.

Resources