Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
exceptions.hpp File Reference
#include <sysio/vm/utils.hpp>
#include <cstdint>
#include <exception>
Include dependency graph for exceptions.hpp:

Go to the source code of this file.

Classes

struct  sysio::vm::exception
 

Namespaces

namespace  sysio
 
namespace  sysio::vm
 

Macros

#define SYS_VM_ASSERT(expr, exc_type, msg)
 
#define DECLARE_EXCEPTION(name, _code, _what)
 

Macro Definition Documentation

◆ DECLARE_EXCEPTION

#define DECLARE_EXCEPTION ( name,
_code,
_what )
Value:
struct name : public sysio::vm::exception { \
name(std::string msg) : msg(msg) {} \
virtual const char* what()const throw() { return _what; } \
virtual const char* detail()const throw() { return msg.c_str(); } \
uint32_t code()const { return _code; } \
std::string msg; \
};
std::string name
unsigned int uint32_t
Definition stdint.h:126
virtual const char * what() const =0
virtual const char * detail() const =0

Definition at line 20 of file exceptions.hpp.

20#define DECLARE_EXCEPTION(name, _code, _what) \
21 struct name : public sysio::vm::exception { \
22 name(std::string msg) : msg(msg) {} \
23 virtual const char* what()const throw() { return _what; } \
24 virtual const char* detail()const throw() { return msg.c_str(); } \
25 uint32_t code()const { return _code; } \
26 std::string msg; \
27 };

◆ SYS_VM_ASSERT

#define SYS_VM_ASSERT ( expr,
exc_type,
msg )
Value:
if (!UNLIKELY(expr)) { \
throw exc_type{msg}; \
}
#define UNLIKELY(x)

Definition at line 8 of file exceptions.hpp.

8#define SYS_VM_ASSERT( expr, exc_type, msg ) \
9 if (!UNLIKELY(expr)) { \
10 throw exc_type{msg}; \
11 }