Archived
This forum has been archived. Please start a new discussion on GitHub.
Exceptions in Ice v3.2
Hi,
I really like the fact that Ice v3.2 exceptions derive from std::exception -- in a bunch of places I have catch-all-and-generate-error-message blocks, and the extra catch block for Ice::Exception makes it ugly.
Unfortunately I think I still need the extra block to generate meaningful error messages. Compare the following:
(a)
catch ( Ice::Exception &e ) {
cout << e << endl;
}
(b)
catch ( std::Exception &e ) {
cout << e.what() << endl;
}
(a) produces:
Network.cpp:662: Ice::ConnectionRefusedException:
connection refused: Connection refused
while (b) produces:
N3Ice26ConnectionRefusedExceptionE
What's going on here? Am I missing something?
Thanks,
Alex
I really like the fact that Ice v3.2 exceptions derive from std::exception -- in a bunch of places I have catch-all-and-generate-error-message blocks, and the extra catch block for Ice::Exception makes it ugly.
Unfortunately I think I still need the extra block to generate meaningful error messages. Compare the following:
(a)
catch ( Ice::Exception &e ) {
cout << e << endl;
}
(b)
catch ( std::Exception &e ) {
cout << e.what() << endl;
}
(a) produces:
Network.cpp:662: Ice::ConnectionRefusedException:
connection refused: Connection refused
while (b) produces:
N3Ice26ConnectionRefusedExceptionE
What's going on here? Am I missing something?
Thanks,
Alex
0
Comments
-
Unfortunately that's a bug. Ice exceptions should (but do not) override std::exception::what().
Cheers,
Bernard0 -
Thanks for the bug report! We've fixed this but, because the change is binary incompatible, it will become available only with the next major release.
Cheers,
Michi.0