1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-12-27 21:35:41 +00:00

Add reason_code to string lookup.

This commit is contained in:
King_DuckZ 2017-05-14 03:43:38 +01:00
parent ec80734625
commit 57dc0c7717

View file

@ -41,7 +41,15 @@ namespace tawashi {
if (reason_int >= 0 and reason_int < ErrorReasons::_size()) if (reason_int >= 0 and reason_int < ErrorReasons::_size())
reason_code = ErrorReasons::_from_integral(reason_int); reason_code = ErrorReasons::_from_integral(reason_int);
parContext["error_message"] = "No error"; std::array<const char*, ErrorReasons::_size()> err_descs {
"Submitted pastie is either too short or too long and was rejected.",
"Submitted pastie couldn't be saved.",
"The pastie was not saved because the client is submitting too many pasties too quickly. Please wait a bit longer and try again.",
"An unknown error was raised.",
"Unable to connect to Redis."
};
parContext["error_message"] = err_descs[reason_code];
parContext["error_code"] = std::to_string(err_code); parContext["error_code"] = std::to_string(err_code);
parContext["error_id"] = std::to_string(reason_code); parContext["error_id"] = std::to_string(reason_code);
} }