Hresult Throw
You will notice that the exception is thrown from Workbook.Close. Your main code throws some exception. You catch it and throw another exception. Now you call Close and that fails (I do not know why yet). We have similar code, also using UserPrincipal.ChangePassword, that has been working for years but started returning the same exception on February 15, 2016.
Hi, The policy is not causing this problem. Similarly for Ross above, this problem has appeared recently and is not consistent. On the day I reported this problem we found it impossible to change passwords on the two accounts that we tried. System.ArgumentException HResult=0x80070057 Message=An item with the same key has already been added. Key:.14 Source=System.Private.CoreLib StackTrace: at.
-->A helper function that takes a HRESULT error code, and throws an exception using a C++/WinRT object (or a standard object) that represents that error code.
Throw Hresult
If the error code is E_OUTOFMEMORY, then std::bad_alloc is thrown. If the error code is a common HRESULT error code, then one of the specialized types derived from winrt::hresult_error is thrown. For example, E_INVALIDARG causes a winrt::hresult_invalid_argument to be thrown. Otherwise, winrt::hresult_error is thrown.
Syntax
Parameters
result
An HRESULT code that represents the error that was encountered.
Requirements
Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)
Namespace: winrt
Header %WindowsSdkDir%Include<WindowsTargetPlatformVersion>cppwinrtwinrtbase.h (included by default)
See also
Hresult Thrown
Language | ||||
Standard Library Headers | ||||
Freestanding and hosted implementations | ||||
Named requirements | ||||
Language support library | ||||
Concepts library(C++20) | ||||
Diagnostics library | ||||
Utilities library | ||||
Strings library | ||||
Containers library | ||||
Iterators library | ||||
Ranges library(C++20) | ||||
Algorithms library | ||||
Numerics library | ||||
Localizations library | ||||
Input/output library | ||||
Filesystem library(C++17) | ||||
Regular expressions library(C++11) | ||||
Atomic operations library(C++11) | ||||
Thread support library(C++11) | ||||
Technical Specifications |
|
|
|
|
Member functions |
Defined in header <exception> |
Provides consistent interface to handle errors through the throw expression.
All exceptions generated by the standard library inherit from std::exception
Hresult Throw
- future_error(C++11)
- bad_optional_access(C++17)
- regex_error(C++11)
- system_error(C++11)
- ios_base::failure(C++11)
- filesystem::filesystem_error(C++17)
- tx_exception(TM TS)
- nonexistent_local_time(C++20)
- ambiguous_local_time(C++20)
- format_error(C++20)
- bad_any_cast(C++17)
- bad_weak_ptr(C++11)
- bad_function_call(C++11)
- bad_array_new_length(C++11)
- ios_base::failure(until C++11)
- bad_variant_access(C++17)
[edit]Member functions
constructs the exception object (public member function) | |
[virtual] | destroys the exception object (virtual public member function)[edit] |
copies exception object (public member function)[edit] | |
[virtual] | returns an explanatory string (virtual public member function)[edit] |