blob: 6f79bd8e3837a3194c3386b2bb9f37a8a1e75b77 [file] [log] [blame]
Allen Webbfbf534f2017-09-14 14:29:00 -07001#include <nos/NuggetClient.h>
2
3#include <application.h>
4
5namespace nos {
6
7#define ErrorString_helper(x) \
8 case app_status::x: \
9 return #x;
10
11std::string NuggetClient::StatusCodeString(uint32_t code) {
12 switch (code) {
13 ErrorString_helper(APP_SUCCESS)
14 ErrorString_helper(APP_ERROR_BOGUS_ARGS)
15 ErrorString_helper(APP_ERROR_INTERNAL)
16 ErrorString_helper(APP_ERROR_TOO_MUCH)
17 ErrorString_helper(APP_ERROR_RPC)
18 default:
19 if (code >= APP_LINE_NUMBER_BASE && code < MAX_APP_STATUS) {
20 return "APP_LINE_NUMBER " + std::to_string(code - APP_LINE_NUMBER_BASE);
21 }
22 if (code >= APP_SPECIFIC_ERROR && code < APP_LINE_NUMBER_BASE) {
23 return "APP_SPECIFIC_ERROR " + std::to_string(APP_LINE_NUMBER_BASE) +
24 " + " + std::to_string(code - APP_LINE_NUMBER_BASE);
25 }
26
27 return "unknown";
28 }
29}
30
31} // namespace nos