MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / ShowFailure

Function ShowFailure

SampleApps/WebView2APISample/CheckFailure.cpp:10–16  ·  view source on GitHub ↗

Notify the user of a failure with a message box.

Source from the content-addressed store, hash-verified

8#include <sstream>
9// Notify the user of a failure with a message box.
10void ShowFailure(HRESULT hr, const std::wstring& message)
11{
12 std::wstringstream formattedMessage;
13 formattedMessage << message << ": 0x" << std::hex << std::setw(8) << hr << " ("
14 << winrt::hresult_error(hr).message().c_str() << ")";
15 MessageBox(nullptr, formattedMessage.str().c_str(), nullptr, MB_OK);
16}
17
18// If something failed, show the error code and fail fast.
19void CheckFailure(HRESULT hr, const std::wstring& message)

Calls

no outgoing calls

Tested by

no test coverage detected