VirtualBox

Ignore:
Timestamp:
Dec 9, 2008 2:40:31 PM (16 years ago)
Author:
vboxsync
Message:

#3285: Improve error handling API to include unique error numbers
Document

  • IMedium::getSnapshotIds
  • IMedium::lockRead
  • IMedium::unlockRead
  • IMedium::lockWrite
  • IMedium::unlockWrite
  • IMedium::close
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MediumImpl.cpp

    r15124 r15178  
    238238                                         ComSafeGUIDArrayOut (aSnapshotIds))
    239239{
    240     if (Guid (aMachineId).isEmpty())
    241         return E_INVALIDARG;
    242     if (ComSafeGUIDArrayOutIsNull (aSnapshotIds))
    243         return E_POINTER;
     240    CheckComArgExpr(aMachineId, Guid (aMachineId).isEmpty() == false);
     241    CheckComArgSafeArrayNotNull(aSnapshotIds);
    244242
    245243    AutoCaller autoCaller (this);
     
    372370        default:
    373371        {
    374             rc = setError (E_FAIL,
     372            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    375373                tr ("Medium '%ls' is not locked for reading"),
    376374                m.locationFull.raw());
     
    451449        default:
    452450        {
    453             rc = setError (E_FAIL,
     451            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    454452                tr ("Medium '%ls' is not locked for writing"),
    455453                m.locationFull.raw());
     
    497495
    498496    if (m.backRefs.size() != 0)
    499         return setError (E_FAIL,
     497        return setError (VBOX_E_OBJECT_IN_USE,
    500498            tr ("Medium '%ls' is attached to %d virtual machines"),
    501499                m.locationFull.raw(), m.backRefs.size());
     
    855853        case MediaState_NotCreated:
    856854        {
    857             rc = setError (E_FAIL,
     855            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    858856                tr ("Storage for the medium '%ls' is not created"),
    859857                m.locationFull.raw());
     
    862860        case MediaState_Created:
    863861        {
    864             rc = setError (E_FAIL,
     862            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    865863                tr ("Storage for the medium '%ls' is already created"),
    866864                m.locationFull.raw());
     
    869867        case MediaState_LockedRead:
    870868        {
    871             rc = setError (E_FAIL,
     869            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    872870                tr ("Medium '%ls' is locked for reading by another task"),
    873871                m.locationFull.raw());
     
    876874        case MediaState_LockedWrite:
    877875        {
    878             rc = setError (E_FAIL,
     876            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    879877                tr ("Medium '%ls' is locked for writing by another task"),
    880878                m.locationFull.raw());
     
    885883            /* be in sync with Console::powerUpThread() */
    886884            if (!m.lastAccessError.isEmpty())
    887                 rc = setError (E_FAIL,
     885                rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    888886                    tr ("Medium '%ls' is not accessible. %ls"),
    889887                    m.locationFull.raw(), m.lastAccessError.raw());
    890888            else
    891                 rc = setError (E_FAIL,
     889                rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    892890                    tr ("Medium '%ls' is not accessible"),
    893891                    m.locationFull.raw());
     
    896894        case MediaState_Creating:
    897895        {
    898             rc = setError (E_FAIL,
     896            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    899897                tr ("Storage for the medium '%ls' is being created"),
    900898                m.locationFull.raw(), m.lastAccessError.raw());
     
    903901        case MediaState_Deleting:
    904902        {
    905             rc = setError (E_FAIL,
     903            rc = setError (VBOX_E_INVALID_OBJECT_STATE,
    906904                tr ("Storage for the medium '%ls' is being deleted"),
    907905                m.locationFull.raw(), m.lastAccessError.raw());
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