diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-04-10 17:52:40 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2011-04-10 17:52:40 +0000 |
commit | e5b9facd63d655cfaa31d440c5d11452bb542460 (patch) | |
tree | 1140ce6aba51381247b37eb4203b047706dc9161 /CIAO | |
parent | a283719d83a3032e005dcb6782360b0e19c586e2 (diff) | |
download | ATCD-e5b9facd63d655cfaa31d440c5d11452bb542460.tar.gz |
Sun Apr 10 17:51:42 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu>
* ciao/Base/CIAO_Exceptions.idl:
* ciao/Containers/Container_Base.idl:
* ciao/Containers/Container_Base_T.cpp:
* ciao/Deployment/Handlers/Component_Handler.cpp:
* ciao/Deployment/Handlers/Home_Handler.cpp:
* ciao/Deployment/Handlers/Homed_Component_Handler.cpp:
Improved error handling.
Diffstat (limited to 'CIAO')
-rw-r--r-- | CIAO/ChangeLog | 11 | ||||
-rw-r--r-- | CIAO/ciao/Base/CIAO_Exceptions.idl | 6 | ||||
-rw-r--r-- | CIAO/ciao/Containers/Container_Base.idl | 6 | ||||
-rw-r--r-- | CIAO/ciao/Containers/Container_Base_T.cpp | 75 | ||||
-rw-r--r-- | CIAO/ciao/Deployment/Handlers/Component_Handler.cpp | 19 | ||||
-rw-r--r-- | CIAO/ciao/Deployment/Handlers/Home_Handler.cpp | 19 | ||||
-rw-r--r-- | CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp | 28 |
7 files changed, 141 insertions, 23 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 9885a6317e0..9274f534c8b 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,14 @@ +Sun Apr 10 17:51:42 UTC 2011 William R. Otte <wotte@dre.vanderbilt.edu> + + * ciao/Base/CIAO_Exceptions.idl: + * ciao/Containers/Container_Base.idl: + * ciao/Containers/Container_Base_T.cpp: + * ciao/Deployment/Handlers/Component_Handler.cpp: + * ciao/Deployment/Handlers/Home_Handler.cpp: + * ciao/Deployment/Handlers/Homed_Component_Handler.cpp: + + Improved error handling. + Sun Apr 10 12:04:57 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> * MPC/config/ndds_ts_default.mpb: diff --git a/CIAO/ciao/Base/CIAO_Exceptions.idl b/CIAO/ciao/Base/CIAO_Exceptions.idl index ab96a26cb7d..3cb9f6c7c3f 100644 --- a/CIAO/ciao/Base/CIAO_Exceptions.idl +++ b/CIAO/ciao/Base/CIAO_Exceptions.idl @@ -14,4 +14,10 @@ module CIAO string name; string reason; }; + + exception InvalidComponent + { + string name; + string reason; + }; }; diff --git a/CIAO/ciao/Containers/Container_Base.idl b/CIAO/ciao/Containers/Container_Base.idl index 6f7f5373609..a97f59cbdd8 100644 --- a/CIAO/ciao/Containers/Container_Base.idl +++ b/CIAO/ciao/Containers/Container_Base.idl @@ -12,7 +12,7 @@ #include "ccm/CCM_StandardConfigurator.idl" #include "ccm/CCM_CCMException.idl" #include "ciao/Containers/CIAO_Servant_Activator.idl" - +#include "ciao/Base/CIAO_Exceptions.idl" #include "ccm/CCM_Exceptions.idl" #include "ccm/CCM_Navigation.idl" @@ -62,10 +62,6 @@ module CIAO }; }; - exception InvalidComponent - { - }; - /** * @interface Container * @brief Internal container interfaces. diff --git a/CIAO/ciao/Containers/Container_Base_T.cpp b/CIAO/ciao/Containers/Container_Base_T.cpp index b3fc50d465b..2955e135760 100644 --- a/CIAO/ciao/Containers/Container_Base_T.cpp +++ b/CIAO/ciao/Containers/Container_Base_T.cpp @@ -421,7 +421,7 @@ namespace CIAO CIAO_ERROR (1, (LM_ERROR, CLINFO "Container_i::activate_component - " "Caught unknown while retrieving servant\n")); - throw InvalidComponent (); + throw CIAO::InvalidComponent (); } if (!svt) @@ -545,7 +545,7 @@ namespace CIAO template <typename BASE> void Container_i<BASE>::set_attributes (CORBA::Object_ptr compref, - const ::Components::ConfigValues & values) + const ::Components::ConfigValues & values) { CIAO_TRACE("Container_i::set_attributes"); @@ -559,22 +559,38 @@ namespace CIAO } catch (CORBA::Exception &ex) { + std::ostringstream err; + err << "Internal Container Error: " + << "Caught CORBA Exception while retrieving servant: " + << ex._info ().c_str (); + CIAO_ERROR (1, (LM_ERROR, CLINFO - "Container_i::set_attributes - " - "Caught CORBA exception while retrieving servant: %C", - ex._info ().c_str ())); - throw CIAO::InvalidComponent (); + "Container_i::set_attributes - %C\n", + err.str ().c_str ())); + throw CIAO::InvalidComponent (0, + err.str ().c_str ()); } catch (...) { - CIAO_ERROR (1, (LM_EMERGENCY, "ex in ref to servant\n")); - throw CIAO::InvalidComponent (); + CIAO_ERROR (1, (LM_EMERGENCY, CLINFO + "Container_i::set_attributes - %C\n" + "Internal Container Error: Unknown C++ exception " + "while retrieving servant.\n")); + throw CIAO::InvalidComponent (0, + "Internal Container Error: Unknown C++ " + "exception while retrieving servant."); } if (!svt) { - CIAO_ERROR (1, (LM_EMERGENCY, "invalid servant reference\n")); - throw CIAO::InvalidComponent (); + CIAO_ERROR (1, (LM_EMERGENCY, CLINFO + "Container_i::set_attributes - %C\n" + "Internal Container Error: " + "Invalid servant reference from reference_to_servant\n")); + + throw CIAO::InvalidComponent (0, + "Internal Container Error: " + "Invalid servant reference from reference_to_servant"); } else { @@ -605,8 +621,12 @@ namespace CIAO } else { - CIAO_ERROR (1, (LM_EMERGENCY, "not home or component\n")); - throw CIAO::InvalidComponent (); + CIAO_ERROR (1, (LM_EMERGENCY, CLINFO + "Container_i::set_attributes - " + "Internal Container Error: Instance isn't a home or component\n")); + throw CIAO::InvalidComponent (0, + "Internal Container Error: " + "Instance isn't a home or component\n"); } } } @@ -620,16 +640,34 @@ namespace CIAO "to servant pointer.\n")); throw; } - catch (const CORBA::Exception &ex) + catch (const CORBA::BAD_PARAM &) { + std::ostringstream err; + err << "Caught BAD_PARAM while setting attributes. Likely indicates incorrect " + << "data type in directive.\n"; + CIAO_ERROR (1, (LM_ERROR, CLINFO "Container_i::set_attributes - " - "Caught CORBA exception while configuring " - "component attributes: %C\n", - ex._info ().c_str ())); - throw; + "Error: %C\n", + err.str ().c_str ())); + + throw Installation_Failure (0, + err.str ().c_str ()); + } + catch (const CORBA::Exception &ex) + { + std::ostringstream err; + err << "Caught CORBA exception while configuring attributes: " + << ex._info ().c_str (); + + CIAO_ERROR (1, + (LM_ERROR, + CLINFO + "Container_i::set_attributes - %C\n", + err.str ().c_str ())); + throw Installation_Failure (0,err.str ().c_str ()); } catch (...) { @@ -640,7 +678,8 @@ namespace CIAO "Caught unknown C++ exception while " "configuring component attributes.\n")); - throw; + throw Installation_Failure (0, + "Unknown C++ exception while configuring attributes\n"); } } diff --git a/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp index 1da6e2b9f23..4bf7d3cdd37 100644 --- a/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Component_Handler.cpp @@ -202,8 +202,27 @@ namespace CIAO container->set_attributes (comp_ref.in (), attr_config); } + catch (::CIAO::InvalidComponent &ex) + { + if (ex.name.in () == 0) + { + ex.name = idd.name; + } + + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Component_Handler::install_instance - " + "Caught InvalidComponent exception: %C:%C\n", + ex.name.in (), ex.reason.in ())); + throw ::Deployment::StartError (ex.name.in (), + ex.reason.in ()); + } catch (::CIAO::Installation_Failure &ex) { + if (ex.name.in () == 0) + { + ex.name = idd.name; + } + CIAO_ERROR (1, (LM_ERROR, CLINFO "Component_Handler::install_instance - " "Caught Installation_Failure exception: %C:%C\n", diff --git a/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp index 12801778c2b..af873593ff6 100644 --- a/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Home_Handler.cpp @@ -199,8 +199,27 @@ namespace CIAO container->set_attributes (home_ref.in (), attr_config); } + catch (::CIAO::InvalidComponent &ex) + { + if (ex.name.in () == 0) + { + ex.name = idd.name; + } + + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Component_Handler::install_instance - " + "Caught InvalidComponent exception: %C:%C\n", + ex.name.in (), ex.reason.in ())); + throw ::Deployment::StartError (ex.name.in (), + ex.reason.in ()); + } catch (::CIAO::Installation_Failure &ex) { + if (ex.name.in () == 0) + { + ex.name = idd.name; + } + CIAO_ERROR (1, (LM_ERROR, CLINFO "Home_Handler::install_instance - " "Caught Installation_Failure exception: %C:%C\n", diff --git a/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp index 4cd96ab38aa..c2c82df40e4 100644 --- a/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp +++ b/CIAO/ciao/Deployment/Handlers/Homed_Component_Handler.cpp @@ -134,6 +134,34 @@ namespace CIAO container->set_attributes (ref.in (), attr_config); } + catch (::CIAO::InvalidComponent &ex) + { + if (ex.name.in () == 0) + { + ex.name = idd.name; + } + + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Component_Handler::install_instance - " + "Caught InvalidComponent exception: %C:%C\n", + ex.name.in (), ex.reason.in ())); + throw ::Deployment::StartError (ex.name.in (), + ex.reason.in ()); + } + catch (::CIAO::Installation_Failure &ex) + { + if (ex.name.in () == 0) + { + ex.name = idd.name; + } + + CIAO_ERROR (1, (LM_ERROR, CLINFO + "Component_Handler::install_instance - " + "Caught Installation_Failure exception: %C:%C\n", + ex.name.in (), ex.reason.in ())); + throw ::Deployment::StartError (ex.name.in (), + ex.reason.in ()); + } catch (const CORBA::Exception &ex) { CIAO_ERROR (1, (LM_ERROR, CLINFO |