Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C++ Exceptions and Catch-All Handlers

C++ Exceptions and Catch-All Handlers

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++hardware
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheGlynn
    wrote on last edited by
    #1

    I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?

    J J P 3 Replies Last reply
    0
    • T TheGlynn

      I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      Does std::exception::what() help you? Or do you need to differtiate the exception objects at runtime and react on their type? Then typeid may help you (look for RTTI in MSDN)to determine the type of the exception-object you caught. But maybe you simply can replace the catch(...) with a list of catches for the exception classes you need.


      My opinions may have changed, but not the fact that I am right.

      1 Reply Last reply
      0
      • T TheGlynn

        I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?

        J Offline
        J Offline
        John M Drescher
        wrote on last edited by
        #3

        DaGlynn wrote: Do I have to use SEH to do this? I think so. Below is a link to the code that I use in all my applications to do this: http://www.codeproject.com/cpp/seexception.asp?target=seh[^] John

        1 Reply Last reply
        0
        • T TheGlynn

          I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #4

          DaGlynn wrote: Do I have to use SEH to do this? according to the docs, yes. You can use GetExceptionInformation() to do that - but this can be called only insode the __except() filter


          "Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
          sighist | Agile Programming | doxygen

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups