Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Handling Exception: third party library
QtWS25 Last Chance

Handling Exception: third party library

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 782 Views
  • 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.
  • F Offline
    F Offline
    fem_dev
    wrote on last edited by
    #1

    First of all, I read other posts about Qt and Exceptions (like this), but I not found a solution to my case.

    I'm using a third party C++ library called HighFive (github link) in my Qt GUI project to write and read data in HDF5 format.

    It's working. I can read and write data with this.
    The problem is that: Every time when I try to read/write data using this library, the library emit a exception and Qt Creator IDE shows it in a GUI popup window and I can't catch it in a try/catch block.
    This simple example below is a completly new Qt Console application project created just to test the try/catch block:

    int main(int argc, char *argv[])
    {
        QCoreApplication app(argc, argv);
    
        // Create a HDF5 file on disk:
        H5Easy::File file("test.h5", H5Easy::File::Overwrite);
        // Create some data:
        std::vector<double> data = { 1, 2, 3, 4, 5 };
    
        // Try to write data into the HDF5 file:
        try {
            H5Easy::dump(file, "/path/to/my/data", data);
        } catch (...) {
            qDebug() << "I CATCH A EXCEPTION";
        }
    
        return app.exec();
    }
    

    When the debugger hits the line:

    H5Easy::dump(file, "/path/to/my/data", data);
    

    The debugger goes to a internal HighFive library file that emits the exception (GUI popup window):
    bf9f536a-179a-47b7-b1ba-39afc5e46405-image.png

    What can I do inside my main.cpp to handle this exception and not get this popup window above?

    PS.: I talked to the HighFive team about it. They asked me to test the same example using Microsoft Visual Studio 2019 and it works great without erros or exceptions. So they think that this case is about some special configuration on the Qt Creator IDE.
    You can see the discussion here.

    My system:

    • Windows 10 x64
    • Qt Creator IDE 4.10.1 (32 bits)
    • Visual Studio 2019 Enterprise

    Compiler and Debugger:
    69ce2c46-5b71-4cfc-a353-67317e6d7092-image.png

    Again: All is working! I just want to "disable/mute" this exceptions or catch it in a try/catch block.
    How can I do that?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      One thing that is indeed different is the debugger. Unless it changed recently, the Visual Studio debugger was only available to Visual Studio itself. You had to install a standalone debugger which might be different that the one embedded in Visual Studio.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      F 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        One thing that is indeed different is the debugger. Unless it changed recently, the Visual Studio debugger was only available to Visual Studio itself. You had to install a standalone debugger which might be different that the one embedded in Visual Studio.

        F Offline
        F Offline
        fem_dev
        wrote on last edited by
        #3

        @SGaist Well...I don't know...
        I was thinking that this debugger (image above in red) is the VS 2019 debugger and Qt is using the same debugger.

        C:\ Program Files (x86)\Wnidows Kits\10\Debuggers\x64\cdb.exe
        

        Is it not the same?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          As I said, things may have changed with VS2019. Do you remember its installation ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          F 1 Reply Last reply
          0
          • SGaistS SGaist

            As I said, things may have changed with VS2019. Do you remember its installation ?

            F Offline
            F Offline
            fem_dev
            wrote on last edited by
            #5

            @SGaist yes...the installation was clear and it said nothing about the compiler/debugger name or type.
            It was like: Next, next, next, finish...done!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Are you talking about the Qt installation or the VS2019 one ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved