summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pexception.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/pexception.h')
-rw-r--r--src/lib/netlist/plib/pexception.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h
index e6c350a04b3..ba99b71cf73 100644
--- a/src/lib/netlist/plib/pexception.h
+++ b/src/lib/netlist/plib/pexception.h
@@ -15,16 +15,26 @@
namespace plib {
- //============================================================
- // terminate
- //============================================================
-
- /*! Terminate the program
+ /*! Terminate the program.
*
* \note could be enhanced by setting a termination handler
*/
[[noreturn]] void terminate(const pstring &msg) noexcept;
+
+ ///! throw an exception.
+ ///
+ /// throws an exception E. The purpose is to clearly identify exception
+ /// throwing in the code
+ ///
+ /// @tparam E Type of exception to be thrown
+ ///
+ template<typename E, typename... Args>
+ [[noreturn]] static inline void pthrow(Args&&... args) noexcept(false)
+ {
+ throw E(std::forward<Args>(args)...);
+ }
+
//============================================================
// exception base
//============================================================