Node.spin() return non-zero error code at the correct work

I use method spin from uavcan::Node class like this:

static constexpr unsigned nodeMemoryPoolSize = 16384;     // 4KB - 512KB
	
typedef uavcan::Node<nodeMemoryPoolSize> Node;

Node& GetNode()
{
	static Node mynode(GetCanDriver(), uavcan_stm32::SystemClock::instance());
	return mynode;
}

void NodeSpin() 
{
	int32_t errorCode;
	if ((errorCode= GetNode().spin(uavcan::MonotonicDuration::fromMSec(100))) != 0)
		ErrorHandler(__LINE__);
}

In errorCode located value 1. I stopped at the breakpoint in IF and looked at the call stack to understand where this value came from. This 1 comes from the method receive in uc_stm32_can.cpp:

uavcan::int16_t CanIface::receive(uavcan::CanFrame& out_frame, uavcan::MonotonicTime& out_ts_monotonic,
                                  uavcan::UtcTime& out_ts_utc, uavcan::CanIOFlags& out_flags)
{
    out_ts_monotonic = clock::getMonotonic();  // High precision is not required for monotonic timestamps
    uavcan::uint64_t utc_usec = 0;
    {
        CriticalSectionLocker lock;
        if (rx_queue_.getLength() == 0)
        {
            return 0;
        }
        rx_queue_.pop(out_frame, utc_usec, out_flags);
    }
    out_ts_utc = uavcan::UtcTime::fromUSec(utc_usec);
    return 1;
}

And the most question is - why recieve return 0 then rx_queue is empty and 1 in other case(which is also the correct situation), although the 1 is an error code from error.hpp:
const int16_t ErrFailure = 1; ///< General failure

Or errors are only negative error codes?

You should read the documentation :wink:

A negative return value represents an error; a non-negative value represents a success. Non-negative values come from here, representing the number of CAN frames that were processed during the call:

Correct.