blob: 7ba6a5c2a99f9022e9a0679c8793057130dccc7e [file] [log] [blame]
#pragma once
#include <string>
#include <unordered_map>
namespace vpd
{
enum error_code
{
// File exceptions
FILE_NOT_FOUND = 2001, /*Just a random value*/
FILE_ACCESS_ERROR,
EMPTY_FILE,
// JSON exceptions
INVALID_JSON,
MISSING_FLAG,
MISSING_ACTION_TAG,
FRU_PATH_NOT_FOUND,
JSON_PARSE_ERROR,
JSON_MISSING_GPIO_INFO,
// Generic errors.
INVALID_INPUT_PARAMETER,
DEVICE_NOT_PRESENT,
DEVICE_PRESENCE_UNKNOWN,
GPIO_LINE_EXCEPTION
};
const std::unordered_map<int, std::string> errorCodeMap = {
{error_code::FILE_NOT_FOUND, "File does not exist."},
{error_code::FILE_ACCESS_ERROR, "Failed to access the file."},
{error_code::EMPTY_FILE, "Empty file."},
{error_code::INVALID_JSON,
"Either JSON is missing FRU tag or invalid JSON object."},
{error_code::MISSING_FLAG,
"JSON is missing the flag to procees for the FRU."},
{error_code::MISSING_ACTION_TAG,
"JSON is missing the action tag to be performed for the FRU."},
{error_code::FRU_PATH_NOT_FOUND, "The FRU path is not found in the JSON."},
{error_code::JSON_PARSE_ERROR, "Error while parsing JSON file."},
{error_code::INVALID_INPUT_PARAMETER,
"Either one of the input parameter is invalid or empty."},
{error_code::JSON_MISSING_GPIO_INFO, "JSON missing required GPIO info."},
{error_code::DEVICE_NOT_PRESENT,
"Presence pin read successfully but device was absent."},
{error_code::DEVICE_PRESENCE_UNKNOWN, "Exception on presence line GPIO."},
{error_code::GPIO_LINE_EXCEPTION, "There was an exception in GPIO line."}};
} // namespace vpd