summaryrefslogtreecommitdiff
path: root/source/core/slang-exception.h
blob: 3c5621d7fa3fc1904d63f294fd9aae3640bf8bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef SLANG_CORE_EXCEPTION_H
#define SLANG_CORE_EXCEPTION_H

#include "slang-common.h"
#include "slang-string.h"

namespace Slang
{
    // NOTE!
    // Exceptions should not generally be used in core/compiler-core, use the 'signal' mechanism
    // ideally using the macros in the slang-signal.h such as `SLANG_UNEXPECTED`
    //
    // If core/compiler-core libraries are compiled with SLANG_DISABLE_EXCEPTIONS,
    // these classes will *never* be thrown.
    
	class Exception
	{
	public:
		String Message;
		Exception()
		{}
		Exception(const String & message)
			: Message(message)
		{
		}

        virtual ~Exception()
        {}
	};

	class InvalidOperationException : public Exception
	{
	public:
		InvalidOperationException()
		{}
		InvalidOperationException(const String & message)
			: Exception(message)
		{
		}

	};
	
	class InternalError : public Exception
	{
	public:
		InternalError()
		{}
		InternalError(const String & message)
			: Exception(message)
		{
		}
	};

    class AbortCompilationException : public Exception
    {
    public:
        AbortCompilationException()
        {}
        AbortCompilationException(const String & message)
            : Exception(message)
        {
        }
    };
}

#endif