Fix error handling incosistencies and add missing checks
Fix error handling incosistencies and add missing checks

Fixes https://github.com/benmcollins/libjwt/issues/132 and https://github.com/benmcollins/libjwt/issues/128

benmcollins/libjwt