yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie Hermaszewskaformatf65d756bf

master
1.2 KiB60 linesraw
1#ifndef SLANG_CORE_EXCEPTION_H
2#define SLANG_CORE_EXCEPTION_H
3
4#include "slang-common.h"
5#include "slang-string.h"
6
7namespace Slang
8{
9// NOTE!
10// Exceptions should not generally be used in core/compiler-core, use the 'signal' mechanism
11// ideally using the macros in the slang-signal.h such as `SLANG_UNEXPECTED`
12//
13// If core/compiler-core libraries are compiled with SLANG_DISABLE_EXCEPTIONS,
14// these classes will *never* be thrown.
15
16class Exception
17{
18public:
19    String Message;
20    Exception() {}
21    Exception(const String& message)
22        : Message(message)
23    {
24    }
25
26    virtual ~Exception() {}
27};
28
29class InvalidOperationException : public Exception
30{
31public:
32    InvalidOperationException() {}
33    InvalidOperationException(const String& message)
34        : Exception(message)
35    {
36    }
37};
38
39class InternalError : public Exception
40{
41public:
42    InternalError() {}
43    InternalError(const String& message)
44        : Exception(message)
45    {
46    }
47};
48
49class AbortCompilationException : public Exception
50{
51public:
52    AbortCompilationException() {}
53    AbortCompilationException(const String& message)
54        : Exception(message)
55    {
56    }
57};
58} // namespace Slang
59
60#endif