Fix handling of invalid JSON input

Ref. #201

Use the exception object itself to generate the error message instead of
its message attribute because that message attribute is no longer valid
in Python 3.

Actually this has also uncovered an
Merge pull request #202 from makinacorpus/fix-201

Fix handling of invalid JSON input