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-2025 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 <string>
27#include <stdexcept>
28
29#include "Translation.h"
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
39class ProcessError : public std::runtime_error {
40
41public:
44
46 ProcessError(const std::string& msg);
47
49 const std::string& getTrace() const;
50
51private:
53 std::string myTrace;
54
56 void processTrace();
57};
58
59
66
67public:
69 InvalidArgument(const std::string& message);
70};
71
72
77class EmptyData : public ProcessError {
78
79public:
81 EmptyData();
82};
83
84
91
92public:
94 FormatException(const std::string& msg);
95};
96
97
105
106public:
108 NumberFormatException(const std::string& data);
109};
110
111
118
119public:
121 TimeFormatException(const std::string& data);
122};
123
124
131
132public:
134 BoolFormatException(const std::string& data);
135};
136
137
144
145public:
147 OutOfBoundsException(const std::string& msg = TL("Out Of Bounds"));
148};
149
150
157
158public:
161
163 UnknownElement(const std::string& msg);
164};
165
169class IOError : public ProcessError {
170
171public:
173 IOError(const std::string& message);
174};
175
177#ifdef MSVC_TEST_SERVER
178#ifdef _DEBUG
179#define SOFT_ASSERT(expr) if (!(expr)) {throw ProcessError(TL("should not happen"));}
180#else
181#define SOFT_ASSERT(expr)
182#endif
183#else
184#define SOFT_ASSERT(expr) assert(expr);
185#endif
#define TL(string)
Definition MsgHandler.h:304
EmptyData()
constructor
ProcessError()
constructor
std::string myTrace
exception trace
void processTrace()
process trace
const std::string & getTrace() const
get trace
UnknownElement()
constructor