Archived

This forum has been archived. Please start a new discussion on GitHub.

Dump on Exception in C++ Service?

Hi,

Normally the ICE Service (C++) class catches all user exceptions and continues on happily. Is there a nice way to disable this behavior so that an exception simply causes the process to exit (so you can get a stack trace)? If the exception is generated from a call to another server, is there a good way to know what remote operation generated the exception?

Thanks,

Comments

  • benoit
    benoit Rennes, France
    Hi Andrew,

    Note that this isn't really specific to the Ice::Service class implementation. Any exceptions raised by a servant method implementation is catch by the Ice server runtime and causes a dispatch warning to be displayed if Ice.Warn.Dispatch=1 (the default).

    There's no way to change this behavior and there's also no easy way to figure out which Ice invocation (from the servant implementation) might have caused the exception. The best is to catch and handle exceptions from Ice invocations if you don't want these exceptions to propagate. You could also add a catch block in your servant method implementation to catch unexpected exceptions and terminate the server.

    With Ice 3.3b, you could also write a dispatch interceptor to catch unexpected exceptions raised by a servant method implementation and eventually terminate the process. Note however that this new feature is not documented yet in the Ice 3.3b manual, it will be for the final release. You can take a look at the dispatch interceptor test from test/Ice/interceptor to see how it works in the meantime.

    Cheers,
    Benoit.