You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by David Fishburn <fi...@ianywhere.com> on 2003/07/31 20:58:38 UTC

Getting error information from exceptions

Xalan 1.5, Xerces 2.2.0

Coming from the samples, I have code like:
            try
            {
                // Create an instance of the class we wrote to handle
                // the callbacks...
                CallbackHandler		theHandler(api, arg_handle,
&retval);

                // Do the transform...
                ret = theXalanTransformer.transform(
                        //xml_str.c_str(),
                        theXMLStream,
                        inputSource,
                        &theHandler,
                        writeCallback,
                        flushCallback);

                if(ret != 0)
                {
                    cerr << "Error: " <<
theXalanTransformer.getLastError() << endl;
                }
            }
            catch(...)
            {
                    cerr << "Error: " <<
theXalanTransformer.getLastError() << endl;
            }


In the catch block, theXalanTransformer.getLastError() has nothing in
it.
Is there anyway (this could be a simple C++ question) to actually get
some *meaningful* message on what threw an exception.  You can do this
easily in Java, so there must be something similar in C++.

Thanks in advance.
Dave


Re: Getting error information from exceptions

Posted by da...@us.ibm.com.



Hi Dave,

This shouldn't happen -- there should always be some sort of information in
the error message, and your catch block should never be entered.  A couple
of things to try:

   1. Run your input document and stylesheet through the command line and
   see what happens.
   2. If you can come up with a minimal document and stylesheet which
   reproduces the problem, create a Bugzilla report and attach the
   documents.

Also, your compiler and platform information would be helpful.

Dave



                                                                                                                                  
                      "David Fishburn"                                                                                            
                      <fishburn@ianywh         To:      <xa...@xml.apache.org>                                            
                      ere.com>                 cc:      (bcc: David N Bertoni/Cambridge/IBM)                                      
                                               Subject: Getting error information from exceptions                                 
                      07/31/2003 11:58                                                                                            
                      AM                                                                                                          
                                                                                                                                  




Xalan 1.5, Xerces 2.2.0

Coming from the samples, I have code like:
            try
            {
                // Create an instance of the class we wrote to handle
                // the callbacks...
                CallbackHandler                        theHandler(api,
arg_handle,
&retval);

                // Do the transform...
                ret = theXalanTransformer.transform(
                        //xml_str.c_str(),
                        theXMLStream,
                        inputSource,
                        &theHandler,
                        writeCallback,
                        flushCallback);

                if(ret != 0)
                {
                    cerr << "Error: " <<
theXalanTransformer.getLastError() << endl;
                }
            }
            catch(...)
            {
                    cerr << "Error: " <<
theXalanTransformer.getLastError() << endl;
            }


In the catch block, theXalanTransformer.getLastError() has nothing in
it.
Is there anyway (this could be a simple C++ question) to actually get
some *meaningful* message on what threw an exception.  You can do this
easily in Java, so there must be something similar in C++.

Thanks in advance.
Dave