From 5e6c7d6d26349139ff5881a67c7fec3f48df6aa3 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Fri, 9 Dec 2016 02:00:49 +0100 Subject: cmis: add error handling on checkin Change-Id: I3951a237789ee4b7697f70bc527ffbb6a626206a Reviewed-on: https://gerrit.libreoffice.org/31776 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- ucb/source/ucp/cmis/cmis_content.cxx | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 05de98078935..65ba37d484fd 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1052,8 +1052,14 @@ namespace cmis { object = getObject( xEnv ); } - catch ( const libcmis::Exception& ) + catch ( const libcmis::Exception& e ) { + SAL_INFO( "ucb.ucp.cmis", "Unexpected libcmis exception: " << e.what( ) ); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_GENERAL, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString::createFromAscii( e.what() ) ); } libcmis::Document* pPwc = dynamic_cast< libcmis::Document* >( object.get( ) ); @@ -1071,8 +1077,22 @@ namespace cmis copyData( xIn, xOutput ); map< string, libcmis::PropertyPtr > newProperties; - libcmis::DocumentPtr pDoc = pPwc->checkIn( rArg.MajorVersion, OUSTR_TO_STDSTR( rArg.VersionComment ), newProperties, - pOut, OUSTR_TO_STDSTR( rArg.MimeType ), OUSTR_TO_STDSTR( rArg.NewTitle ) ); + libcmis::DocumentPtr pDoc; + + try + { + pDoc = pPwc->checkIn( rArg.MajorVersion, OUSTR_TO_STDSTR( rArg.VersionComment ), newProperties, + pOut, OUSTR_TO_STDSTR( rArg.MimeType ), OUSTR_TO_STDSTR( rArg.NewTitle ) ); + } + catch ( const libcmis::Exception& e ) + { + SAL_INFO( "ucb.ucp.cmis", "Unexpected libcmis exception: " << e.what( ) ); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_GENERAL, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString::createFromAscii( e.what() ) ); + } // Get the URL and send it back as a result URL aCmisUrl( m_sURL ); -- cgit