src/core/geometry/exceptions.h

Collection of all geometry exceptions. More…

Namespaces

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

Classes

Name
class allpix::InvalidDetectorError
Indicates an error with finding a detector by name.
class allpix::InvalidDetectorModelError
Indicates an error that the detector model is not found.
class allpix::DetectorExistsError
Indicates an attempt to add a detector that is already registered before.
class allpix::PassiveElementExistsError
Indicates an attempt to add a detector that is already registered before.
class allpix::DetectorModelExistsError
Indicates an attempt to add a detector model that is already registered before.
class allpix::DetectorInvalidNameError
Indicates an attempt to add a detector with an invalid name.

Detailed Description

Collection of all geometry exceptions.

Copyright: Copyright (c) 2017-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_GEOMETRY_EXCEPTIONS_H
#define ALLPIX_GEOMETRY_EXCEPTIONS_H

#include <string>

#include "core/utils/exceptions.h"
#include "core/utils/type.h"

namespace allpix {
    class InvalidDetectorError : public RuntimeError {
    public:
        explicit InvalidDetectorError(const std::string& name) {
            error_message_ = "Could not find a detector with name '" + name + "'";
        }
    };

    class InvalidDetectorModelError : public RuntimeError {
    public:
        explicit InvalidDetectorModelError(const std::string& name) {
            error_message_ = "Could not find a detector model of type '" + name + "'";
        }
    };

    class DetectorExistsError : public RuntimeError {
    public:
        explicit DetectorExistsError(const std::string& name) {
            error_message_ = "Detector with name " + name + " is already registered, detector names have to be unique";
        }
    };

    class PassiveElementExistsError : public RuntimeError {
    public:
        explicit PassiveElementExistsError(const std::string& name) {
            error_message_ = "Element with name " + name + " is already registered, element names have to be unique";
        }
    };

    class DetectorModelExistsError : public RuntimeError {
    public:
        explicit DetectorModelExistsError(const std::string& name) {
            error_message_ = "Model with type " + name + " is already registered, model names have to be unique";
        }
    };

    class DetectorInvalidNameError : public RuntimeError {
    public:
        explicit DetectorInvalidNameError(const std::string& name) {
            error_message_ = "Detector name " + name + " is invalid, choose a different name";
        }
    };
} // namespace allpix
#endif /* ALLPIX_GEOMETRY_EXCEPTIONS_H */

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