main/sfx2/source/doc/DocumentMetadataAccess.cxx
/** error handling policy.
    <p>If a handler is given, ask it how to proceed:
    <ul><li>(default:) cancel import, raise exception</li>
        <li>ignore the error and continue</li>
        <li>retry the action that led to the error</li></ul></p>
    N.B.: must not be called before DMA is fully initialized!
    @returns true if caller should retry
 */
error handling policy.
If a handler is given, ask it how to proceed:
(default:) cancel import, raise exception
ignore the error and continue
retry the action that led to the error
N.B.: must not be called before DMA is fully initialized!
error handling policy . If a handler is given ask it how to proceed : ( default : ) cancel import raise exception ignore the error and continue retry the action that led to the error N . B . : must not be called before DMA is fully initialized!
static bool
handleError( ucb::InteractiveAugmentedIOException const & i_rException,
    const uno::Reference<task::XInteractionHandler> & i_xHandler)
{
    if (!i_xHandler.is()) {
        throw lang::WrappedTargetException(::rtl::OUString::createFromAscii(
            "DocumentMetadataAccess::loadMetadataFromStorage: exception"),
             0, uno::makeAny(i_rException));
    }
    ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest(
        new ::comphelper::OInteractionRequest(uno::makeAny(i_rException)) );
    ::rtl::Reference< ::comphelper::OInteractionRetry > pRetry(
        new ::comphelper::OInteractionRetry );
    ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove(
        new ::comphelper::OInteractionApprove );
    ::rtl::Reference< ::comphelper::OInteractionAbort > pAbort(
        new ::comphelper::OInteractionAbort );
    pRequest->addContinuation( pApprove.get() );
    pRequest->addContinuation( pAbort.get() );
    i_xHandler->handle( pRequest.get() );
    if (pRetry->wasSelected()) {
        return true;
    } else if (pApprove->wasSelected()) {
        return false;
    } else {
        OSL_ENSURE(pAbort->wasSelected(), "no continuation selected?");
        throw lang::WrappedTargetException(::rtl::OUString::createFromAscii(
            "DocumentMetadataAccess::loadMetadataFromStorage: exception"),
             0, uno::makeAny(i_rException));
    }
}
static bool handleError ( ucb :: InteractiveAugmentedIOException const & i_rException , const uno :: Reference < task :: XInteractionHandler > & i_xHandler ) { if ( ! i_xHandler . is ( ) ) { throw lang :: WrappedTargetException ( :: rtl :: OUString :: createFromAscii ( " " ) , 0 , uno :: makeAny ( i_rException ) ) ; } :: rtl :: Reference < :: comphelper :: OInteractionRequest > pRequest ( new :: comphelper :: OInteractionRequest ( uno :: makeAny ( i_rException ) ) ) ; :: rtl :: Reference < :: comphelper :: OInteractionRetry > pRetry ( new :: comphelper :: OInteractionRetry ) ; :: rtl :: Reference < :: comphelper :: OInteractionApprove > pApprove ( new :: comphelper :: OInteractionApprove ) ; :: rtl :: Reference < :: comphelper :: OInteractionAbort > pAbort ( new :: comphelper :: OInteractionAbort ) ; pRequest -> addContinuation ( pApprove . get ( ) ) ; pRequest -> addContinuation ( pAbort . get ( ) ) ; i_xHandler -> handle ( pRequest . get ( ) ) ; if ( pRetry -> wasSelected ( ) ) { return true ; } else if ( pApprove -> wasSelected ( ) ) { return false ; } else { OSL_ENSURE ( pAbort -> wasSelected ( ) , " " ) ; throw lang :: WrappedTargetException ( :: rtl :: OUString :: createFromAscii ( " " ) , 0 , uno :: makeAny ( i_rException ) ) ; } }
error handling policy.
error handling policy .
/* *this*/ /* this does not seem to work
    if (i_rException.Code != ucb::IOErrorCode_WRONG_FORMAT) {
        pRequest->addContinuation( pRetry.get() );
    }
    */ // actually call the handler /* *this*/