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();
|
layout.render();
|
||||||
renderer->present();
|
renderer->present();
|
||||||
}
|
}
|
||||||
} catch (const bwidgets::BaseException& e) {
|
|
||||||
std::cerr << "Error: " << e.what << std::endl;
|
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define BWIDGETS_EXCEPTION_HPP
|
#define BWIDGETS_EXCEPTION_HPP
|
||||||
|
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <exception>
|
#include <stdexcept>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -10,11 +10,9 @@
|
||||||
|
|
||||||
namespace bwidgets
|
namespace bwidgets
|
||||||
{
|
{
|
||||||
struct BaseException : std::exception
|
struct BaseException : std::runtime_error
|
||||||
{
|
{
|
||||||
std::string what;
|
using runtime_error::runtime_error;
|
||||||
|
|
||||||
BaseException(std::string w) noexcept : what(std::move(w)) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
Loading…
Reference in a new issue