Fix error handling, extend testcases, add errors to documentation

* Searched for error-codes and had to look into source code
* maybe this is useful ;)
this provided the ability to use `instanceof` to check errors.  why are you not exporting it?