Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion library/public/exception.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef f3d_exception_h
#define f3d_exception_h

#include "export.h"

/// @cond
#include <stdexcept>
#include <string>
Expand All @@ -15,7 +17,7 @@ namespace f3d
* A generic exception used in the libf3d.
* Can be used to catch all exceptions when needed.
*/
struct exception : public std::runtime_error
struct F3D_EXPORT exception : public std::runtime_error
{
explicit exception(const std::string& what = "")
: std::runtime_error(what)
Expand Down
12 changes: 12 additions & 0 deletions library/testing/TestSDKEngineExceptions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ int TestSDKEngineExceptions([[maybe_unused]] int argc, [[maybe_unused]] char* ar
});
#endif

#ifndef _WIN32
// Test exception inheritance
try
{
std::ignore = f3d::context::wgl();
}
catch (const f3d::exception& e)
{
// should be caught here
}
#endif

// Test loadPlugin error handling
test.expect<f3d::engine::plugin_exception>("load plugin with invalid library",
[&]() { f3d::engine::loadPlugin(std::string(argv[1]) + "data/invalid.so"); });
Expand Down
Loading