nn_errcode now sets EINVAL on failure
Add documentation for nn_errorcode