VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Exception.h
1// -----------------------------------------------------------------------------
2// This file is part of VirtualC64
3//
4// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5// This FILE is dual-licensed. You are free to choose between:
6//
7// - The GNU General Public License v3 (or any later version)
8// - The Mozilla Public License v2
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11// -----------------------------------------------------------------------------
12
13#pragma once
14
15#include "Types.h"
16#include <exception>
17
18namespace vc64::util {
19
22struct Exception : public std::exception {
23
25 i64 data;
26
29
30 Exception(i64 d, const string &s) : data(d), description(s) { }
31 Exception(i64 d) : data(d), description("") { }
32 Exception(const string &s) : data(0), description(s) { }
33 Exception() : data(0) { }
34
35 const char *what() const noexcept override { return description.c_str(); }
36};
37
38//
39// Syntactic sugar
40//
41
50#define throws noexcept(false)
51
52}
Base class for all emulator exceptions.
Definition Exception.h:22
string description
Auxiliary information about the thrown errow.
Definition Exception.h:28
i64 data
Error code.
Definition Exception.h:25