Document error codes

I have documented error codes in the file errors.h.