peary/device/exceptions.hpp

Peary device exceptions. More…

Namespaces

Name
peary
peary::device Forward declaration of CaribouDevice, Board, and Carboard classes.

Classes

Name
class peary::device::DeviceError Base class for device-related errors.
class peary::device::InvalidInstanceError Exception class for running instance errors.
class peary::device::InvalidDeviceError Exception class for invalid device errors.
class peary::device::LibraryError Exception class for library errors.
class peary::device::DataTakingError Exception class for data taking errors.

Detailed Description

Peary device 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::device {

    class DeviceError : public utils::RuntimeError {
    public:
        explicit DeviceError(std::string_view reason) : utils::RuntimeError(std::string(reason)) {}

    protected:
        DeviceError() = default;
    };

    class InvalidInstanceError : public DeviceError {
    public:
        explicit InvalidInstanceError(std::string_view name) {
            _message = "Found running instance of ";
            _message += name;
        }
    };

    class InvalidDeviceError : public DeviceError {
    public:
        explicit InvalidDeviceError(std::string_view device, std::string_view reason) {
            _message = "Invalid device ";
            _message += device;
            if(!reason.empty()) {
                _message += ": ";
                _message += reason;
            }
        }
    };

    class LibraryError : public DeviceError {
    public:
        explicit LibraryError(std::string reason) { _message = reason; }
    };

    class DataTakingError : public DeviceError {
    public:
        explicit DataTakingError(std::string_view reason) { _message = reason; }
    };
} // namespace peary::device
  

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