Document error codes

I have documented the error codes in errors.h.