2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef GIMBAL_EXCEPTION_H
25#define GIMBAL_EXCEPTION_H
27#include "../meta/instances/gimbal_object.h"
28#include <gimbal/core/gimbal_thread.h>
31
32
33
35#define GBL_EXCEPTION(self) (GBL_CAST(GblException, self))
37#define GBL_EXCEPTION_GET_CLASS(self) (GBL_CLASSOF(GblException, self))
41
42
43
44
46#define GBL_THROW(type, ...)
48#define GBL_CATCH_AS(type, name)
51#define GBL_SELF_TYPE GblException
58
59
60
61
62
63
64
65
74
75
76
77
78
79
80
81
82
83
109
110
111
123
124
125
126
157#define GblException_create(derived, result, ...)
#define GBL_CLASS_CAST(cType, klass)
#define GBL_FORWARD_DECLARE_STRUCT(S)
#define GBL_TYPEID(instanceStruct)
#define GBL_INSTANCE_DERIVE(derivedInstance, baseInstance)
#define GBL_CLASS_DERIVE(...)
#define GBL_ENUM_TYPE
Type UUID of GblEnumClass.
GblException * GblException_current(void)
Returns a pointer to the current thread's pending GblException or NULL if there isn't one.
GblType GblException_type(void)
Returns the GblType UUID corresponding to GblException.
GblException * GblException_catch(GblType type)
Takes ownership of the current thread's active GblException if it matches type, otherwise returns NUL...
GblBool GblException_clear(void)
Clears the current thread's active GblException, returning GBL_TRUE if it had one.
void GblException_throw(GblException *pErr)
Sets the given GblException as the current thread's active exception, taking ownership of it.
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)
#define GBL_STRING_TYPE
Builtin ID for string GblVariant type.
#define GBL_PROPERTIES(object,...)
Declares a list of properties for the given object/instance structure.
#define GBL_THREAD_TYPE
Type UUID for GblThread.
uint32_t GblEnum
Standard-sized enum type, 32-bits across platforms.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
uint16_t GblRefCount
Type able to hold a reference counter across the codebase.
const char GblStringRef
Reference-counted, const char*-compatible string type.
GblType resultType
A GblEnum type representing the exception's set of error codes.
Object containing an application error and its context.
GblStringRef * pMessage
Custom message associated with the error.
size_t line
Line of code form which the exception was generated.
const char * pFunction
Function from which the exception was generated.
GblType GblException_resultType(const GblException *pSelf)
Returns the enumeration type of the GblException::result code.
GblType resultType
Most derived type of the GblException::result code.
GblException * GblException_create(GblType derived, const char *pFile, const char *pFunc, size_t line, GblType resultType, GblEnum result, const char *pFmt,...)
Creates a GblException of the derived type, with the given properties.
GblRefCount GblException_unref(GblException *pSelf)
Decrements and returns the refcount of a GblException, potentially destroying it.
GblThread * pThread
Thread that generated the exception.
const char * pFile
Source file from which the exception was generated.
const char * GblException_function(const GblException *pSelf)
Returns a non-NULL string containing the function name from which the GblException originated.
size_t GblException_line(const GblException *pSelf)
Returns the source code line number from which the GblException originated.
GblEnum result
Result status code representing the error.
const char * GblException_file(const GblException *pSelf)
Returns a non-NULL string containing the source file from which the GblException originated.
const char * GblException_resultString(const GblException *pSelf)
Returns the string representation of the GblException::result code.
GblBool GblException_hasSource(const GblException *pSelf)
Returns GBL_TRUE if the given GblException has a source context associated with it.
GblException * GblException_ref(const GblException *pSelf)
Returns a new reference to an existing GblException, incrementing its refcount.