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. What exception is thrown that I catch with a catch(..)?

What exception is thrown that I catch with a catch(..)?

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • P Offline
    P Offline
    Per Nilsson
    wrote on last edited by
    #1

    Hi Does anyone know how I can find out what exception has actualy been thrown when I catch it with catch (...) block. /Per

    T A 2 Replies Last reply
    0
    • P Per Nilsson

      Hi Does anyone know how I can find out what exception has actualy been thrown when I catch it with catch (...) block. /Per

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      all the other exceptions that has not been catched with previous catch block. you can imagine its behavior like the default statement of a switch...


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      P 1 Reply Last reply
      0
      • T toxcct

        all the other exceptions that has not been catched with previous catch block. you can imagine its behavior like the default statement of a switch...


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        P Offline
        P Offline
        Per Nilsson
        wrote on last edited by
        #3

        I woul'd like to catch the exception, but I don't know what type it is. Can I figure that out in some way?

        T 1 Reply Last reply
        0
        • P Per Nilsson

          I woul'd like to catch the exception, but I don't know what type it is. Can I figure that out in some way?

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          i don't think so


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          S 1 Reply Last reply
          0
          • T toxcct

            i don't think so


            TOXCCT >>> GEII power
            [toxcct][VisualCalc]

            S Offline
            S Offline
            Steve S
            wrote on last edited by
            #5

            I don't think so either. In cases where you specify the exception type, you can do something like catch(CexType& ex) and that gives you an object you can interrogate, perhaps using RTTI, but in the ellipsis case, there's nothing to help you. Steve S Developer for hire

            1 Reply Last reply
            0
            • P Per Nilsson

              Hi Does anyone know how I can find out what exception has actualy been thrown when I catch it with catch (...) block. /Per

              A Offline
              A Offline
              Andrew Walker
              wrote on last edited by
              #6

              Most frameworks provide a base class that all exceptions should be derived from for this reason. For example MFC has a CException class. In all but the most exceptional (pun intended) circumstances exceptions should derive from std::exception, the exception base class for the C++ Standard library. Rather than catch(...), use catch(std::exception& )


              If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts your aim; Yours is the Earth and everything that's in it. Rudyard Kipling

              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