don't inherit directly from std::excption but from derived type and use their constructor.
This commit is contained in:
parent
50a324cc95
commit
718af15b07
|
@ -88,8 +88,6 @@ void run_example(
|
|||
layout.render();
|
||||
renderer->present();
|
||||
}
|
||||
} catch (const bwidgets::BaseException& e) {
|
||||
std::cerr << "Error: " << e.what << std::endl;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "Error: " << e.what() << std::endl;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define BWIDGETS_EXCEPTION_HPP
|
||||
|
||||
#include <any>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
||||
|
@ -10,11 +10,9 @@
|
|||
|
||||
namespace bwidgets
|
||||
{
|
||||
struct BaseException : std::exception
|
||||
struct BaseException : std::runtime_error
|
||||
{
|
||||
std::string what;
|
||||
|
||||
BaseException(std::string w) noexcept : what(std::move(w)) {}
|
||||
using runtime_error::runtime_error;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Reference in New Issue