:github_url: https://github.com/nyx-org/gaia .. _program_listing_file_lib_error.hpp: Program Listing for File error.hpp ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``lib/error.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace Gaia { enum class Error { UNKNOWN, NOT_IMPLEMENTED, NO_SUCH_FILE_OR_DIRECTORY, IS_A_DIRECTORY, OUT_OF_MEMORY, INVALID_PARAMETERS, PERMISSION_DENIED, NOT_FOUND, TYPE_MISMATCH, NOT_A_DIRECTORY, NOT_A_TTY, INVALID_FILE, FULL, EMPTY, }; inline frg::string_view error_to_string(Error error) { switch (error) { case Error::UNKNOWN: return "Unknown error"; case Error::NOT_IMPLEMENTED: return "Not implemented"; case Error::NO_SUCH_FILE_OR_DIRECTORY: return "No such file or directory"; case Error::IS_A_DIRECTORY: return "Is a directory"; case Error::OUT_OF_MEMORY: return "Out of memory"; case Error::INVALID_PARAMETERS: return "Invalid parameters"; case Error::PERMISSION_DENIED: return "Permission denied"; case Error::NOT_FOUND: return "Not found"; case Error::TYPE_MISMATCH: return "Type mismatch"; case Error::NOT_A_DIRECTORY: return "Not a directory"; case Error::NOT_A_TTY: return "Not a TTY"; case Error::INVALID_FILE: return "Invalid file"; case Error::FULL: return "Full"; case Error::EMPTY: return "Empty"; } return ""; } } // namespace Gaia