1
0
mirror of https://github.com/pumpitupdev/pumptools.git synced 2024-11-24 07:00:09 +01:00

capnhook/result: Extend error code list

This commit is contained in:
icex2 2020-12-31 19:54:59 +01:00
parent fb69d87c15
commit 6492e4df1a
2 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,8 @@ int cnh_result_to_errno(enum cnh_result result)
return EPIPE; return EPIPE;
case CNH_RESULT_TIMER_EXPIRED: case CNH_RESULT_TIMER_EXPIRED:
return ETIME; return ETIME;
case CNH_RESULT_NO_DATA_AVAILABLE:
return ENODATA;
default: default:
log_warn("Unhandled other error %d to errno convert might cause bugs", result); log_warn("Unhandled other error %d to errno convert might cause bugs", result);
return EIO; return EIO;
@ -92,6 +94,8 @@ enum cnh_result cnh_errno_to_result(int errn)
return CNH_RESULT_BROKEN_PIPE; return CNH_RESULT_BROKEN_PIPE;
case ETIME: case ETIME:
return CNH_RESULT_TIMER_EXPIRED; return CNH_RESULT_TIMER_EXPIRED;
case ENODATA:
return CNH_RESULT_NO_DATA_AVAILABLE;
default: default:
log_warn("Unhandled errno to general error convert might cause bugs, errno: %d", errn); log_warn("Unhandled errno to general error convert might cause bugs, errno: %d", errn);
return CNH_RESULT_OTHER_ERROR; return CNH_RESULT_OTHER_ERROR;

View File

@ -31,6 +31,7 @@ enum cnh_result {
CNH_RESULT_NO_SUCH_DEVICE_OR_ADDRESS = 17, CNH_RESULT_NO_SUCH_DEVICE_OR_ADDRESS = 17,
CNH_RESULT_BROKEN_PIPE = 18, CNH_RESULT_BROKEN_PIPE = 18,
CNH_RESULT_TIMER_EXPIRED = 19, CNH_RESULT_TIMER_EXPIRED = 19,
CNH_RESULT_NO_DATA_AVAILABLE = 20,
}; };
/** /**