Program Listing for File error.hpp

Return to documentation for file (zeem/error.hpp)

// Copyright (c) 2024-2026 Maarten L. Hekkelman
// SPDX-License-Identifier: BSD-2-Clause

#pragma once

#ifndef ZEEM_CXX_MODULE
# include <exception>
# include <string>
#endif

namespace zeem
{

ZEEM_EXPORT class exception : public std::exception
{
  public:
    explicit exception(std::string message)
        : m_message(std::move(message))
    {
    }

    [[nodiscard]] const char *what() const noexcept override { return m_message.c_str(); }

  private:
    std::string m_message;
};

} // namespace zeem