make it possible to handle errors

Exposes git error codes / classes as consts. 
Fixes unhandled exception in error type checks
Replaces error type checks with more generic functions
Protects against bad oids causing panic in NewOid