Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
UtilExceptions.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// Exceptions for used by some utility classes
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <cassert>
27#include <string>
28#include <stdexcept>
29
30// ===========================================================================
31// class definitions
32// ===========================================================================
38class ProcessError : public std::runtime_error {
39
40public:
43
45 ProcessError(const std::string& msg);
46
48 const std::string& getTrace() const;
49
50private:
52 std::string myTrace;
53
55 void processTrace();
56};
57
58
65
66public:
68 InvalidArgument(const std::string& message);
69};
70
71
76class EmptyData : public ProcessError {
77
78public:
80 EmptyData();
81};
82
83
90
91public:
93 FormatException(const std::string& msg);
94};
95
96
104
105public:
107 NumberFormatException(const std::string& data);
108};
109
110
117
118public:
120 TimeFormatException(const std::string& data);
121};
122
123
130
131public:
133 BoolFormatException(const std::string& data);
134};
135
136
143
144public:
147
149 OutOfBoundsException(const std::string& msg);
150};
151
152
159
160public:
163
165 UnknownElement(const std::string& msg);
166};
167
171class IOError : public ProcessError {
172
173public:
175 IOError(const std::string& message);
176};
177
179#ifdef MSVC_TEST_SERVER
180#ifdef _DEBUG
181#define SOFT_ASSERT(expr) if (!(expr)) {throw ProcessError("should not happen");}
182#else
183#define SOFT_ASSERT(expr)
184#endif
185#else
186#define SOFT_ASSERT(expr) assert(expr);
187#endif
EmptyData()
constructor
OutOfBoundsException()
constructor (default message: "Out Of Bounds")
ProcessError()
constructor
std::string myTrace
exception trace
void processTrace()
process trace
const std::string & getTrace() const
get trace
UnknownElement()
constructor