src/core/utils/exceptions.h
Base exceptions used in the framework. More…
Namespaces
Name |
---|
allpix Helper class to hold support layers for a detector model. |
Classes
Name | |
---|---|
class | allpix::Exception Base class for all non-internal exceptions in framework. |
class | allpix::RuntimeError Errors related to problems occurring at runtime. |
class | allpix::LogicError Errors related to logical problems in the code structure. |
Detailed Description
Base exceptions used in the framework.
Copyright: Copyright (c) 2016-2024 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT
Source code
#ifndef ALLPIX_EXCEPTIONS_H
#define ALLPIX_EXCEPTIONS_H
#include <exception>
#include <string>
#include "type.h"
namespace allpix {
// NOTE: asserts are used inside the framework for internal errors that should be impossible for modules
class Exception : public std::exception {
public:
explicit Exception(std::string what_arg) : error_message_(std::move(what_arg)) {}
const char* what() const noexcept override { return error_message_.c_str(); }
protected:
Exception() = default;
std::string error_message_;
};
class RuntimeError : public Exception {
public:
explicit RuntimeError(std::string what_arg) : Exception(std::move(what_arg)) {}
protected:
RuntimeError() = default;
};
class LogicError : public Exception {
public:
explicit LogicError(std::string what_arg) : Exception(std::move(what_arg)) {}
protected:
LogicError() = default;
};
} // namespace allpix
#endif /* ALLPIX_EXCEPTIONS_H */
Updated on 2025-02-27 at 14:14:46 +0000