DO Throw exceptions to report exceptional failures.
DO Use
WIL error handling helpers when
handling error code failures (THROW_*()
, RETURN_*()
, FAIL_FAST_*()
, LOG_*()
).
DO Use existing 'HRESULT's if you can. Be careful to pick an existing HRESULT whose symbolic name and message convey the intent and don't mislead the developer, administrator or user.
DO Create new HRESULT
s with FACILITY_ITF
only if you can't
find a reasonable existing one. Any new FACILITY_ITF
error MUST use code values in the range
0x0200-0xFFFF. See
Codes in FACILITY_ITF for
more details.
DO Rely on WIL error handling helpers to log failures.
DO Use TraceLoggingWrite()
to log non-failure information.
DON'T Use WIL's LOG_HR()
to report non-failure information.
LOG_HR()
will FAIL_FAST if handled a SUCCEEDED(hr)
.
DON'T Define error HRESULTS
to pass to LOG_HR()
to report
non-failure information. Non-error information should be reported via TraceLoggingWrite()
.