/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file UtilExceptions.cpp14/// @author Daniel Krajzewicz15/// @author Christian Roessel16/// @author Michael Behrisch17/// @author Felix Brack18/// @date Mon, 17 Dec 200119///20// Exceptions for used by some utility classes21/****************************************************************************/22#include <config.h>2324// stacktrace is not supported in MAC25#if defined(HAVE_BOOST) && !defined(__APPLE__)26#ifdef _MSC_VER27// needed to avoid problem in boost win winsocket28#pragma warning(push, 0)29#define WIN32_LEAN_AND_MEAN30#define NOMINMAX31#include <windows.h>32#include <boost/stacktrace.hpp>33#pragma warning(pop)34#else35#pragma GCC diagnostic push36#pragma GCC diagnostic ignored "-Wall"37#pragma GCC diagnostic ignored "-Wextra"38#include <boost/stacktrace.hpp>39#pragma GCC diagnostic pop40#endif41#endif4243#include "UtilExceptions.h"4445// ===========================================================================46// class definitions47// ===========================================================================4849// ---------------------------------------------------------------------------50// ProcessError - methods51// ---------------------------------------------------------------------------5253ProcessError::ProcessError() :54std::runtime_error(TL("Process Error")) {55// process trace56processTrace();57}585960ProcessError::ProcessError(const std::string& msg) :61std::runtime_error(msg) {62// process trace63processTrace();64}656667const std::string&68ProcessError::getTrace() const {69return myTrace;70}717273void74ProcessError::processTrace() {75// only process if we have boost and we're not in apple76#if defined(HAVE_BOOST) && !defined(__APPLE__)77// declare stacktrace78boost::stacktrace::stacktrace st;79// convert trace using ostringstream80std::ostringstream oss;81oss << st;82myTrace = oss.str();83#endif84}8586// ---------------------------------------------------------------------------87// ProcessError - methods88// ---------------------------------------------------------------------------8990InvalidArgument::InvalidArgument(const std::string& message) :91ProcessError(message) {92}9394// ---------------------------------------------------------------------------95// ProcessError - methods96// ---------------------------------------------------------------------------9798EmptyData::EmptyData() :99ProcessError(TL("Empty Data")) {100}101102// ---------------------------------------------------------------------------103// ProcessError - methods104// ---------------------------------------------------------------------------105106FormatException::FormatException(const std::string& msg) :107ProcessError(msg) {108}109110// ---------------------------------------------------------------------------111// ProcessError - methods112// ---------------------------------------------------------------------------113114NumberFormatException::NumberFormatException(const std::string& data) :115FormatException(TLF("Invalid Number Format %", data)) {116}117118// ---------------------------------------------------------------------------119// ProcessError - methods120// ---------------------------------------------------------------------------121122TimeFormatException::TimeFormatException(const std::string& data) :123FormatException(TLF("Invalid Time Format %", data)) {124}125126// ---------------------------------------------------------------------------127// ProcessError - methods128// ---------------------------------------------------------------------------129130BoolFormatException::BoolFormatException(const std::string& data) :131FormatException(TLF("Invalid Bool Format %", data)) {132}133134// ---------------------------------------------------------------------------135// ProcessError - methods136// ---------------------------------------------------------------------------137138OutOfBoundsException::OutOfBoundsException(const std::string& msg) :139ProcessError(msg) {140}141142143// ---------------------------------------------------------------------------144// ProcessError - methods145// ---------------------------------------------------------------------------146147UnknownElement::UnknownElement() :148ProcessError(TL("Unknown Element")) {149}150151152UnknownElement::UnknownElement(const std::string& msg) :153ProcessError(msg) {154}155156// ---------------------------------------------------------------------------157// ProcessError - methods158// ---------------------------------------------------------------------------159160IOError::IOError(const std::string& message) :161ProcessError(message) {162}163164165