VirtualBox

Ignore:
Timestamp:
Aug 11, 2022 2:35:45 PM (2 years ago)
Author:
vboxsync
Message:

Recording/Main: Propagate errors further up, to let clients ask IRecordingSettings directly what actually went wrong via IVirtualBoxErrorInfo. ​bugref:10275

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/RecordingSettingsImpl.cpp

    r95918 r96137  
    246246    const bool fEnabled = RT_BOOL(enable);
    247247
    248     HRESULT rc = S_OK;
     248    HRESULT hrc = S_OK;
    249249
    250250    if (m->bd->fEnabled != fEnabled)
     
    255255        alock.release();
    256256
    257         rc = m->pMachine->i_onRecordingChange(enable);
    258         if (FAILED(rc))
    259         {
     257        hrc = m->pMachine->i_onRecordingChange(enable);
     258        if (FAILED(hrc))
     259        {
     260            com::ErrorInfo errMachine; /* Get error info from machine call above. */
     261
    260262            /*
    261263             * Normally we would do the actual change _after_ i_onRecordingChange() succeeded.
     
    266268            alock.acquire();
    267269            m->bd->fEnabled = m->bd.backedUpData()->fEnabled;
     270
     271            if (errMachine.isBasicAvailable())
     272                hrc = setError(errMachine);
    268273        }
    269274        else
     
    278283            /** Save settings if online - @todo why is this required? -- @bugref{6818} */
    279284            if (Global::IsOnline(m->pMachine->i_getMachineState()))
    280                 rc = m->pMachine->i_saveSettings(NULL, mlock);
    281         }
    282     }
    283 
    284     return rc;
     285            {
     286                com::ErrorInfo errMachine;
     287                hrc = m->pMachine->i_saveSettings(NULL, mlock);
     288                if (FAILED(hrc))
     289                {
     290                    /* Got error info from machine call above. */
     291                    if (errMachine.isBasicAvailable())
     292                        hrc = setError(errMachine);
     293                }
     294            }
     295        }
     296    }
     297
     298    return hrc;
    285299}
    286300
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette