15e3ff854SRekha Aparna #pragma once 25e3ff854SRekha Aparna 3*9443af22SRekha Aparna #include <string> 4*9443af22SRekha Aparna #include <unordered_map> 5*9443af22SRekha Aparna 65e3ff854SRekha Aparna namespace vpd 75e3ff854SRekha Aparna { 85e3ff854SRekha Aparna namespace error_code 95e3ff854SRekha Aparna { 105e3ff854SRekha Aparna // File exceptions 115e3ff854SRekha Aparna static constexpr auto FILE_NOT_FOUND = 1001; 125e3ff854SRekha Aparna static constexpr auto FILE_ACCESS_ERROR = 1002; 135e3ff854SRekha Aparna static constexpr auto EMPTY_FILE = 1003; 145e3ff854SRekha Aparna 155e3ff854SRekha Aparna // JSON exceptions 165e3ff854SRekha Aparna static constexpr auto INVALID_JSON = 2001; 175e3ff854SRekha Aparna static constexpr auto MISSING_FLAG = 2002; 185e3ff854SRekha Aparna static constexpr auto MISSING_ACTION_TAG = 2003; 195e3ff854SRekha Aparna static constexpr auto FRU_PATH_NOT_FOUND = 2004; 205e3ff854SRekha Aparna 215e3ff854SRekha Aparna // Generic errors. 225e3ff854SRekha Aparna static constexpr auto INVALID_INPUT_PARAMATER = 3001; 23*9443af22SRekha Aparna 24*9443af22SRekha Aparna const std::unordered_map<int, std::string> errorCodeMap = { 25*9443af22SRekha Aparna {FILE_NOT_FOUND, "File does not exist."}, 26*9443af22SRekha Aparna {FILE_ACCESS_ERROR, "Failed to access the file."}, 27*9443af22SRekha Aparna {EMPTY_FILE, "Empty file."}, 28*9443af22SRekha Aparna {INVALID_JSON, "Either JSON is missing FRU tag or invalid JSON object."}, 29*9443af22SRekha Aparna {MISSING_FLAG, "JSON is missing the flag to procees for the FRU."}, 30*9443af22SRekha Aparna {MISSING_ACTION_TAG, 31*9443af22SRekha Aparna "JSON is missing the action tag to be performed for the FRU."}, 32*9443af22SRekha Aparna {FRU_PATH_NOT_FOUND, "The FRU path is not found in the JSON."}, 33*9443af22SRekha Aparna {INVALID_INPUT_PARAMATER, 34*9443af22SRekha Aparna "Either one of the input parameter is invalid or empty."}}; 355e3ff854SRekha Aparna } // namespace error_code 365e3ff854SRekha Aparna } // namespace vpd 37