Add error enumerations

It's a shame we had to duplicate the enumeration from the C definition,
but as enums are pretty much just integers to the compiler ctypes
doesn't have anything to work with to map it.