src/physics/exceptions.h

Collection of model exceptions. More…

Namespaces

Name
allpix
Helper class to hold support layers for a detector model.

Classes

Name
class allpix::ModelError
Base class for all model exceptions in the framework.
class allpix::InvalidModelError
Notifies of an invalid model.
class allpix::ModelUnsuitable
Notifies of a model unsuitable for the current simulation.

Detailed Description

Collection of model exceptions.

Copyright: Copyright (c) 2021-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_MODEL_EXCEPTIONS_H
#define ALLPIX_MODEL_EXCEPTIONS_H

#include <string>

#include "core/utils/exceptions.h"

namespace allpix {
    class ModelError : public RuntimeError {};

    class InvalidModelError : public ModelError {
    public:
        explicit InvalidModelError(const std::string& model_name) {
            error_message_ = "Model with name \"" + model_name + "\" does not exist";
        }
    };

    class ModelUnsuitable : public ModelError {
    public:
        explicit ModelUnsuitable(const std::string& reason = "") {
            error_message_ = "Model not suitable for this simulation: " + reason;
        }
    };
} // namespace allpix

#endif /* ALLPIX_MODEL_EXCEPTIONS_H */

Updated on 2024-12-13 at 08:31:37 +0000