aboutsummaryrefslogtreecommitdiff
path: root/Exception.h
blob: ab9cfcea5b11f869d00fce2eb11b7b33834f1550 (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
#pragma once

#include <cstdarg>
#include <exception>

#include "Node.h"

class Exception : public std::exception {
public:
	Exception(const char * fmt, ...);
	virtual ~Exception();
	virtual const char * what();

protected:
	Exception() = default;
	void va_format(va_list args, const char * fmt);
	char * error = NULL;
};

class ParserException : public Exception {
public:
	using Exception::Exception;
	ParserException(const char * fmt, ...);
};

class CircuitException : public Exception {
public:
	using Exception::Exception;
	CircuitException(const char * fmt, ...);
	Node * node = nullptr;
};

class NodeException : public CircuitException {
public:
	using CircuitException::CircuitException;
	NodeException(Node * node, const char * fmt, ...);
};