Menu

so-5.3.0 Exception reaction inheritance

Yauheni Akhotnikau Boris Sivko

NOTE. for the details about the exception reaction for non-handled exception see [so-5.2.3 Reaction to unhandled exceptions]

A mechanism for reacting to non-handled exception was introduced in v.5.2.3. It has been improved in v.5.3.0.

A new value has been introduced into so_5::rt::exception_reaction_t enumeration: so_5::rt::inherit_exception_reaction. It means that reaction to non-handled exception must be derived from agent’s cooperation.

Henceforth, so_5::rt::agent_coop_t has methods so_5::rt::agent_coop_t::set_exception_reaction() and so_5::rt::agent_coop_t::exception_reaction(). The first one allows to set an exception reaction flag for whole cooperation. The second one returns the exception reaction flag value. But there is a trick: if exception reaction flag for cooperation is inherit_exception_reaction (it is default value) then exception_reaction() for parent cooperation is called. If there is no parent cooperation then so_5::rt::so_environment::exception_reaction() is called.

An exception reaction flag for the whole SO Environment could be set by so_5::rt::so_environment_params_t::exception_reaction() method on environment creation.

All of those mean that now the exception reaction can be set on different levels:

  • at the very top level for SO Environment;
  • at the cooperation level;
  • at the agent level.

By default the exception reaction for SO Environment is abort_on_exception, e.g. application will be aborted if any non-handled exception occurs.

For agent and agent cooperation the default exception reaction is inherit_exception_reaction.


Related

Wiki: SObjectizer v.5.3.0 TODOs
Wiki: so-5.2.3 Reaction to unhandled exceptions
Wiki: so-5.3 Basics
Wiki: so-5.3 By Example Synchronous Services and Exceptions
Wiki: so-5.3.0 Version Info
Wiki: so-5.4 Basics
Wiki: so-5.4 By Example Cooperation Notifications
Wiki: so-5.4 By Example Synchronous Services and Exceptions
Wiki: so-5.5 By Example Cooperation Notifications
Wiki: so-5.5 By Example Exception Reaction