libt2n: (gerd) add lots of error handling code, unit tests for this error handling...