peary/hardware/components/exceptions.hpp

Peary components exceptions. More…

Namespaces

Name
peary
peary::component

Classes

Name
class peary::component::ComponentError Base class for component-related errors This class is used as a base for all component-related exceptions in the Peary library.
class peary::component::ComponentStateError Exception class for component state errors This class is used to represent errors that occur due to invalid component states.

Detailed Description

Peary components exceptions.

Copyright: Copyright (c) 2016-2025 CERN and the Peary Caribou authors. This software is distributed under the terms of the LGPL-3.0-only License, copied verbatim in the file “LICENSE.md”. SPDX-License-Identifier: LGPL-3.0-only

Source code

  
#pragma once

#include "peary/utils/exceptions.hpp"

namespace peary::component {

    class ComponentError : public utils::RuntimeError {};

    class ComponentStateError : public ComponentError {
    public:
        explicit ComponentStateError(std::string_view name, std::string_view reason = "") {
            _message = "Component '" + std::string(name) + "' state error.";
            if(!reason.empty()) {
                _message += ": ";
                _message += reason;
            }
        };
    };

} // namespace peary::component
  

Updated on 2025-11-14 at 11:31:23 +0100