Add decode segment errors

* Specify whether error in heading or string
* Add test cases
* TODO: Refactor errors & tests
Merge pull request #8 from ZhangBanger/decode_error_handling

Add decode segment errors