peary/hal/exceptions.hpp

Peary HAL exceptions. More…

Namespaces

Name
peary
peary::hal

Classes

Name
class peary::hal::HalError Base class for HAL-related errors.
class peary::hal::InvalidResourceError Exception class for invalid resources.

Detailed Description

Peary HAL 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::hal {

    class HalError : public utils::RuntimeError {};

    class InvalidResourceError : public HalError {
    public:
        explicit InvalidResourceError(std::string_view resource, std::string_view reason) {
            _message = "Invalid resource ";
            _message += resource;
            if(!reason.empty()) {
                _message += ": ";
                _message += reason;
            }
        }
    };
} // namespace peary::hal
  

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