Is the derivative of the error the rotation between the derivative of the desired and the derivative of the actual angle or simply the derivative of the error equation?
The excellent book of Christopher Jekeli "Inertial Navigation Systems
with Geodetic Applications" has the answer.
The derivative of the rotation quaternion is given as a function of the skew symmetric matrix A (4x4) composed of 0 in the diagonal and the components of the angular velocities, and the rotation quaternion q.
The previous answer was the first step to write Kalman Filter equations in which quaternion errors (or attitude angles errors) can be part of the state vector to be estimated.