Piotr Caban (@piotr) commented about dlls/vccorlib140/vccorlib.c:
- WINRT_EXCEPTION(InvalidArgument, E_INVALIDARG) \
- WINRT_EXCEPTION(InvalidCast, E_NOINTERFACE) \
- WINRT_EXCEPTION(NotImplemented, E_NOTIMPL) \
- WINRT_EXCEPTION(NullReference, E_POINTER) \
- WINRT_EXCEPTION(ObjectDisposed, RO_E_CLOSED) \
- WINRT_EXCEPTION(OperationCanceled, E_ABORT) \
- WINRT_EXCEPTION(OutOfBounds, E_BOUNDS) \
- WINRT_EXCEPTION(OutOfMemory, E_OUTOFMEMORY) \
- WINRT_EXCEPTION(WrongThread, RPC_E_WRONG_THREAD)
+#define WINRT_EXCEPTION(name, hr) \
- void WINAPI __abi_WinRTraise##name##Exception(void) \
- { \
TRACE("()\n"); \__abi_WinRTraiseCOMException((hr)); \- }
It's mostly a matter of style but I would suggest to implement it the other way around. How about implementing __abi_WinRTraiseCOMException to call __abi_WinRTraise{ERROR}Exception functions (with the actual implementation in error specific functions)? Otherwise __abi_WinRTraiseCOMException will became a big function that would be good to divide into per-exception type helpers.