Tag: cws_src680_dba203a User: fs Date: 06/02/17 04:40:46 Modified: /dba/dbaccess/source/core/dataaccess/ databasedocument.cxx
Log: better exception message when storeTo fails File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: databasedocument.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.25&r2=1.25.12.1 Delta lines: +33 -7 -------------------- --- databasedocument.cxx 7 Feb 2006 10:18:42 -0000 1.25 +++ databasedocument.cxx 17 Feb 2006 12:40:43 -0000 1.25.12.1 @@ -4,9 +4,9 @@ * * $RCSfile: databasedocument.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.25.12.1 $ * - * last change: $Author: rt $ $Date: 2006/02/07 10:18:42 $ + * last change: $Author: fs $ $Date: 2006/02/17 12:40:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -105,6 +105,9 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef _CPPUHELPER_EXC_HLP_HXX_ +#include <cppuhelper/exc_hlp.hxx> +#endif #ifndef BOOST_BIND_HPP_INCLUDED #include <boost/bind.hpp> @@ -495,16 +498,39 @@ Sequence<Any> aParam(2); aParam[0] <<= _rURL; aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE; + Reference<XStorage> xStorage; + ::rtl::OUString sOriginalExceptionType; + ::rtl::OUString sOriginalExceptionMessage; try { xStorage.set(xStorageFactory->createInstanceWithArguments( aParam ),UNO_QUERY); } - catch(Exception&) + catch ( const Exception& e ) { + Any aException( ::cppu::getCaughtException() ); + sOriginalExceptionType = aException.getValueTypeName(); + sOriginalExceptionMessage = e.Message; } + if ( !xStorage.is() ) - throw IOException(); + { + // TODO: localize this + ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii( "Could not store the database document to '" ); + sMessage += _rURL; + sMessage += ::rtl::OUString::createFromAscii( "'." ); + if ( sOriginalExceptionMessage.getLength() ) + { + sMessage += ::rtl::OUString::createFromAscii( "\noriginal error message: " ); + sMessage += sOriginalExceptionMessage; + } + if ( sOriginalExceptionType.getLength() ) + { + sMessage += ::rtl::OUString::createFromAscii( "\noriginal error type: " ); + sMessage += sOriginalExceptionType; + } + throw IOException( sMessage, *this ); + } if ( m_pImpl->isEmbeddedDatabase() ) m_pImpl->clearConnections(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
