Refactor status logic into a class.

Also introduces custom exceptions and adds error raising to Connection#post.