peary/interfaces/exceptions.hpp

Peary interfaces exceptions. More…

Namespaces

Name
peary
peary::interface

Classes

Name
class peary::interface::InterfaceError Base class for interface-related errors.
class peary::interface::InterfaceDeviceError Exception class for interface-related errors.
class peary::interface::CommunicationError Exception class for communication errors.
class peary::interface::WriteError
class peary::interface::ReadError

Detailed Description

Peary interfaces 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 <string_view>

#include "peary/utils/exceptions.hpp"

namespace peary::interface {

    // Forward declaration of Endpoint class
    template <typename EndpointType, typename RegisterType, typename DataType> class Endpoint;

    class InterfaceError : public utils::RuntimeError {};

    class InterfaceDeviceError : public InterfaceError {
    public:
        explicit InterfaceDeviceError(std::string_view reason) { _message = reason; }
    };

    class CommunicationError : public InterfaceError {
    public:
        explicit CommunicationError(std::string_view reason) { _message = reason; }
    };

    class WriteError : public CommunicationError {
    public:
        template <typename EndpointType, typename RegisterType, typename DataType>
        WriteError(Endpoint<EndpointType, RegisterType, DataType>* endpoint, std::string_view reason);
    };

    class ReadError : public CommunicationError {
    public:
        template <typename EndpointType, typename RegisterType, typename DataType>
        ReadError(Endpoint<EndpointType, RegisterType, DataType>* endpoint, std::string_view reason);
    };

} // namespace peary::interface

#include "exceptions.tcc"
  

Updated on 2026-01-30 at 22:01:05 +0100