Make job_dict errors consistent

A job dict's "error" is always either None or a dict with a "message"
key whose value is a string.

Some tests are still failing.
Fix a couple of failing tests
Improve a docstring
Add unit tests for new _validate_error() function
Add as_dict() method to JobError

Let JobError objects provide their own dictionary representation.
Update some doc strings
Avoid SQLAlchemy unicode warnings