Convert HRESULT return value to Exception


  • I vaguely remember reading about a function that would take an HRESULT and throw the proper exception if !SUCCESS().  Does this function already exist or do I remember incorrectly?  If it doesn't exist then it would be easy to implement, but I would rather not rewrite it if not necessary.
    Saturday, March 23, 2013 7:17 PM


All replies

  • Deleted
    • Proposed as answer by Jesse Jiang Monday, March 25, 2013 2:53 AM
    • Marked as answer by Jesse Jiang Friday, March 29, 2013 2:11 AM
    Sunday, March 24, 2013 1:56 PM
  • I get a 500 - Internal server error when I try to go to the blog post.

    My understanding is that when an non SUCCESS HRESULT is returned from a component it is packaged automagically by C++/CX and thrown as an exception deriving from Platform::Exception.  What I want to be able to do is create a function that does the same thing that I can pass an HRESULT to.  I vaguely recall running across the header file where the C++/CX runtime does this, and I was wondering if there was a function that I could explicitly call to do this.

    Wednesday, March 27, 2013 7:00 PM
  • Deleted
    Wednesday, March 27, 2013 11:04 PM