I made my own kind of library for my application to be able to use the winapi in a more OO and clear way and just to use some algorithms. But I have an object with a function that does something asynchronous (with a worker thread). But the thread of the program (usually the main thread) that uses that function should be able to handle any exception that may occur with the worker thread.
I don't have any idea how to do that so my question is if anyone has any idea?
An alternative would be to make the function synchronous and to implement the function asynchronous. Then I can just handle the error from the thread that calls the function. That won't be a problem, since it doesn't matter in which thread the error is handled as long as the thread belongs to the program and not to the library. The library should not handle errors but throw them.