summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-16 22:44:57 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-16 22:44:57 +0000
commitcf8c9f3826cc7cc841b12f505b670720f87549c1 (patch)
treef8003aa6f0fbcec38aa29fb25d65ff8b85469f02 /TAO
parent104a27632de04fc6a5819318db0c00d9819cd651 (diff)
downloadATCD-cf8c9f3826cc7cc841b12f505b670720f87549c1.tar.gz
More exceptions stuff
Diffstat (limited to 'TAO')
-rw-r--r--TAO/tao/Environment.cpp8
-rw-r--r--TAO/tao/Environment.h5
-rw-r--r--TAO/tao/Exception.cpp40
-rw-r--r--TAO/tao/Exception.h5
-rw-r--r--TAO/tao/Invocation.cpp2
5 files changed, 52 insertions, 8 deletions
diff --git a/TAO/tao/Environment.cpp b/TAO/tao/Environment.cpp
index 677345ae6ad..c4ee79da10b 100644
--- a/TAO/tao/Environment.cpp
+++ b/TAO/tao/Environment.cpp
@@ -193,13 +193,11 @@ CORBA::Environment::print_exception (const char *info,
ACE_DEBUG ((LM_ERROR, "(%P|%t) EXCEPTION, %s\n", info));
- // @@ get rid of this logic, and rely on some member function on
- // Exception to say if it's user or system exception.
+ CORBA::SystemException *x2 =
+ CORBA_SystemException::_narrow (this->exception_);
- if (this->exception_type () == CORBA::SYSTEM_EXCEPTION)
+ if (x2 != 0)
{
- CORBA::SystemException *x2 =
- CORBA_SystemException::_narrow (this->exception_);
// @@ there are a other few "user exceptions" in the CORBA
// scope, they're not all standard/system exceptions ... really
diff --git a/TAO/tao/Environment.h b/TAO/tao/Environment.h
index 532f2b1f3c1..51b96263651 100644
--- a/TAO/tao/Environment.h
+++ b/TAO/tao/Environment.h
@@ -89,14 +89,15 @@ public:
// exception.
const char* exception_id (void) const;
- // return the repository ID for the exception
+ // return the repository ID for the exception.
void clear (void);
// Clear the exception.
void print_exception (const char *info,
FILE *f=stdout) const;
- // print the exception to output determined by f
+ // Print the exception to output determined by f.
+ // This function is not CORBA compliant.
// = Obtain a default environment to use with TAO.
static CORBA_Environment &default_environment (void);
diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp
index 0a0649ac240..84d85fa879e 100644
--- a/TAO/tao/Exception.cpp
+++ b/TAO/tao/Exception.cpp
@@ -94,6 +94,46 @@ CORBA_Exception::_is_a (const char* repository_id) const
return (ACE_OS::strcmp (repository_id, "IDL:omg.org/CORBA/Exception:1.0")==0);
}
+void
+CORBA_Exception::print_exception (const char *info,
+ FILE *) const
+{
+ const char *id = this->_id ();
+
+ ACE_DEBUG ((LM_ERROR, "(%P|%t) EXCEPTION, %s\n", info));
+
+ CORBA::SystemException *x2 =
+ CORBA_SystemException::_narrow (ACE_const_cast (CORBA_Exception *,this));
+
+ if (x2 != 0)
+ {
+
+ // @@ there are a other few "user exceptions" in the CORBA
+ // scope, they're not all standard/system exceptions ... really
+ // need to either compare exhaustively against all those IDs
+ // (yeech) or (preferably) to represent the exception type
+ // directly in the exception value so it can be queried.
+
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) system exception, ID '%s'\n",
+ id));
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) minor code = %x, completed = %s\n",
+ x2->minor (),
+ (x2->completed () == CORBA::COMPLETED_YES) ? "YES" :
+ (x2->completed () == CORBA::COMPLETED_NO) ? "NO" :
+ (x2->completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
+ "garbage"));
+ }
+ else
+ // @@ we can use the exception's typecode to dump all the data
+ // held within it ...
+
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) user exception, ID '%s'\n",
+ id));
+}
+
CORBA::ULong
CORBA_Exception::_incr_refcnt (void)
{
diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h
index 787b70c6451..7ecd7a5ff07 100644
--- a/TAO/tao/Exception.h
+++ b/TAO/tao/Exception.h
@@ -67,6 +67,11 @@ public:
// = TAO extension. It makes it easier to write generic code.
static CORBA_Exception* _narrow (CORBA_Exception* x);
+ void print_exception (const char *info,
+ FILE *f=stdout) const;
+ // Print the exception <ex> to output determined by f.
+ // This function is not CORBA compliant.
+
// = Methods required for memory management support.
CORBA::ULong _incr_refcnt (void);
CORBA::ULong _decr_refcnt (void);
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 501fd423365..767d0a531af 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -373,7 +373,7 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
ACE_CATCH (CORBA_SystemException, ex)
{
// Handle the exception for this level here and throw it out again.
- ACE_TRY_ENV.print_exception ("invoke, location forward (decode)");
+ ACE_PRINT_EXCEPTION (ex, "invoke, location forward (decode)");
transport->close_conn ();
ACE_RETHROW;
}