Skip to content

Commit

Permalink
Better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Apr 3, 2024
1 parent 3b86c8a commit 393cda8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions swiftwinrt/Resources/Support/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ private func getErrorDescription(expecting hr: HRESULT) -> String? {
guard GetRestrictedErrorInfo(&errorInfo) == S_OK else { return nil }
guard let errorInfo else { return nil }

// Getting the error info clears it, but it's valuable to keep it
// for crash diagnostics purposes.
// From the docs: https://learn.microsoft.com/en-us/windows/win32/api/roerrorapi/nf-roerrorapi-getrestrictederrorinfo
// > GetRestrictedErrorInfo transfers ownership of the error object to the caller and clears the error state for the thread.
// For crash reporting purposes, it's useful to preserve the error info state.
SetRestrictedErrorInfo(errorInfo)

defer {
Expand Down

0 comments on commit 393cda8

Please sign in to comment.