Implement and assert on error serializer.

Closes #7.