nested-exceptions Questions

9

Solved

I want to catch an exception, that is nested into another exception. I'm doing it currently this way: } catch (RemoteAccessException e) { if (e != null && e.getCause() != null && ...
Handicap asked 2/6, 2010 at 6:26

9

Solved

I am writing some JUnit tests that verify that an exception of type MyCustomException is thrown. However, this exception is wrapped in other exceptions a number of times, e.g. in an InvocationTarge...
Incisure asked 4/3, 2009 at 13:49

4

Solved

I just finished work on a C++-program where I've implemented my own exceptions (although derived from std::exception). The practice I've applied when one exception causes a chain reaction, pr...
Edmondedmonda asked 22/8, 2010 at 22:31

5

Solved

The main problem with throwing exceptions from destructor is that in the moment when destructor is called another exception may be "in flight" (std::uncaught_exception() == true) and so it is not o...
Splinter asked 14/5, 2016 at 13:32

2

Solved

So the way to nest exceptions in C++ using std::nested_exception is: void foo() { try { // code that might throw std::ifstream file("nonexistent.file"); file.exceptions(std::ios_base::failbit)...
Coextensive asked 17/11, 2013 at 21:0

1

Solved

If I define an exception class class Exception : public std::runtime_error { /*...*/ private: std::exception_ptr next; std::exception_ptr prev; } in which I refer to pending exceptions by nex...
Crawley asked 4/6, 2013 at 10:44

1

Solved

I previously asked a question about how to chaining exceptions in C++, and one of the answers provided a nifty solution to how it can be done. The problem is that I don't understand the code, and t...
Rust asked 25/8, 2010 at 14:18
1

© 2022 - 2024 — McMap. All rights reserved.