Changeset 38511 in vbox for trunk/include/VBox/com/ErrorInfo.h
- Timestamp:
- Aug 23, 2011 4:22:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/ErrorInfo.h
r35517 r38511 38 38 namespace com 39 39 { 40 41 /** 42 * General discussion: 43 * 44 * In COM all errors are stored on a per thread basis. In general this means 45 * only _one_ active error is possible per thread. A new error will overwrite 46 * the previous one. To prevent this use MultiResult or ErrorInfoKeeper (see 47 * below). The implementations in MSCOM/XPCOM differ slightly, but the details 48 * are handled by this glue code. 49 * 50 * We have different classes which are involved in the error management. I try 51 * to describe them separately to make clear what they are there for. 52 * 53 * ErrorInfo: 54 * 55 * This class is able to retrieve the per thread error and store it into its 56 * member variables. This class can also handle non VirtualBox errors (like 57 * standard COM errors). 58 * 59 * ProgressErrorInfo: 60 * 61 * This is just a simple wrapper class to get the ErrorInfo stored within a 62 * IProgress object. That is the error which was stored when the progress 63 * object was in use and not an error produced by IProgress itself. 64 * 65 * IVirtualBoxErrorInfo: 66 * 67 * The VirtualBox interface class for accessing error information from Main 68 * clients. This class is also used for storing the error information in the 69 * thread context. 70 * 71 * ErrorInfoKeeper: 72 * 73 * A helper class which stores the current per thread info internally. After 74 * calling methods which may produce other errors it is possible to restore 75 * the previous error and therefore restore the situation before calling the 76 * other methods. 77 * 78 * MultiResult: 79 * 80 * Creating an instance of MultiResult turns error chain saving on. All errors 81 * which follow will be saved in a chain for later access. 82 * 83 * COMErrorInfo (Qt/Gui only): 84 * 85 * The Qt GUI does some additional work for saving errors. Because we create 86 * wrappers for _every_ COM call, it is possible to automatically save the 87 * error info after the execution. This allow some additional info like saving 88 * the callee. Please note that this error info is saved on the client side 89 * and therefore locally to the object instance. See COMBaseWithEI, 90 * COMErrorInfo and the generated COMWrappers.cpp in the GUI. 91 * 92 * Errors itself are set in VirtualBoxBase::setErrorInternal. First a 93 * IVirtualBoxErrorInfo object is created and the given error is saved within. 94 * If MultiResult is active the current per thread error is fetched and 95 * attached to the new created IVirtualBoxErrorInfo object. Next this object is 96 * set as the new per thread error. 97 * 98 * Some general hints: 99 * 100 * - Always use setError, especially when you are work in an asynchrony thread, 101 * to indicate an error. Otherwise the error information itself will not make 102 * it into the client. 103 * 104 */ 40 105 41 106 /**
Note:
See TracChangeset
for help on using the changeset viewer.