File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -183,17 +183,17 @@ WINRT_EXPORT namespace winrt
183183 return *this ;
184184 }
185185
186- explicit hresult_error (hresult const code) noexcept : m_code(code)
186+ explicit hresult_error (hresult const code) noexcept : m_code(verify_error( code) )
187187 {
188188 originate (code, nullptr );
189189 }
190190
191- hresult_error (hresult const code, param::hstring const & message) noexcept : m_code(code)
191+ hresult_error (hresult const code, param::hstring const & message) noexcept : m_code(verify_error( code) )
192192 {
193193 originate (code, get_abi (message));
194194 }
195195
196- hresult_error (hresult const code, take_ownership_from_abi_t ) noexcept : m_code(code)
196+ hresult_error (hresult const code, take_ownership_from_abi_t ) noexcept : m_code(verify_error( code) )
197197 {
198198 com_ptr<impl::IErrorInfo> info;
199199 WINRT_IMPL_GetErrorInfo (0 , info.put_void ());
@@ -306,6 +306,13 @@ WINRT_EXPORT namespace winrt
306306 WINRT_VERIFY (info.try_as (m_info));
307307 }
308308
309+ static hresult verify_error (hresult const code) noexcept
310+ {
311+ WINRT_ASSERT (code < 0 );
312+ return code;
313+ }
314+
315+
309316#ifdef __clang__
310317#pragma clang diagnostic push
311318#pragma clang diagnostic ignored "-Wunused-private-field"
You can’t perform that action at this time.
0 commit comments