tiny style fix
bail out early if length is zero to avoid allocating new array
added "Unkown error" message