Why is VBOX_E_INVALID_VM_STATE used in vastly different situations?

Discussions related to using the OSE version of VirtualBox.
Post Reply
rbarak
Posts: 52
Joined: 25. Sep 2018, 20:43

Why is VBOX_E_INVALID_VM_STATE used in vastly different situations?

Post by rbarak »

I looked at the VBox sources on GitHub, and see that VBOX_E_INVALID_VM_STATE is a catchall error message that is applied in numerous situations, e.g., in the following methods (among others):

Code: Select all

resumeWithReason, pauseWithReason, enableVMMStatistics, onlineMergeMedium, enumerateGuestProperties, onUSBDeviceDetach, accessGuestProperty, onUSBDeviceAttach, onSharedFolderChange, onUSBControllerChange, onVRDEServerChange, onStorageDeviceChange, onMediumChange, onStorageControllerChange, onParallelPortChange, onSerialPortChange, onNetworkAdapterChange, uninitialize, updateMachineState, assignRemoteMachine, assignMachine (target: xpidl, midl), getRemoteConsole, removeDeviceFilter, createDeviceFilter, teleport, restoreSnapshot, deleteSnapshotRange, deleteSnapshotAndAllChildren, takeSnapshot, removeSharedFolder, etc.
Is there a reason that the same error is used in vastly different situations?

This makes it near impossible to know the reason why the guest entered the VBOX_E_INVALID_VM_STATE.

Wouldn't it be better to have individualised error results, linked to the method that produced them, e.g., VBOX_E_INVALID_VM_STATE_in_emoveSharedFolder or VBOX_E_INVALID_VM_STATE_in_takeSnapshot?
That way, the user will at least have an inkling why her guest VM entered the VBOX_E_INVALID_VM_STATE.

If I want to create a branch of the VBox codebase, where I'd implement individualised error messages, which documentation should I read to know which files in https://github.com/mirror/vbox should be changed?
Post Reply