How to simulate inner exception in C++

前端 未结 6 1581
逝去的感伤
逝去的感伤 2021-01-02 19:06

Basically I want to simulate .NET Exception.InnerException in C++. I want to catch exception from bottom layer and wrap it with another exception and throw again to upper la

6条回答
  •  [愿得一人]
    2021-01-02 19:23

    Also I am not sure whether the temporary object that is thrown from func1 will survive even after func2 throw?

    No. Unless you rethrow the exception with throw;. You could implement this if you'd allow only some (limited) set of exception types.

提交回复
热议问题