Skip to content

Opt-in inheritance from std::exception for winrt::hresult_error #1367

@jaigak

Description

@jaigak

Related to #1336, #1129 and #207.

Currently winrt::hresult_error does not inherit from std::exception. When writing cross-platform applications that may use C++/WinRT internally on Windows, one would except that they could catch std::exception to catch all exceptions with error message. Today I need an extra layer to convert an HRESULT to the appropriate std::exception-derived type so the calling code, for example, can just catch std::invalid_argument instead of needing to know about winrt::hresult_invalid_argument.

For the error message, I would recommend lazily converting the hstring into a UTF-8 encoded std::string if winrt::hresult gets inherited from std::exception.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions