diff --git a/flaschengeist/__init__.py b/flaschengeist/__init__.py index 7e5dd23..b18a446 100644 --- a/flaschengeist/__init__.py +++ b/flaschengeist/__init__.py @@ -4,6 +4,8 @@ Initialize also a singleton for the AccessTokenController and start the Thread. """ +from datetime import datetime + import yaml import logging import pkg_resources @@ -33,6 +35,8 @@ class CustomJSONEncoder(JSONEncoder): except AttributeError: pass + if isinstance(o, datetime): + return o.isoformat() # Check if iterable try: iterable = iter(o) @@ -76,7 +80,7 @@ def create_app(): def handle_exception(e): if isinstance(e, HTTPException): logger.debug(e.description, exc_info=True) - return jsonify({"error": e.name}), e.code + return jsonify({"error": e.description}), e.code logger.error(str(e), exc_info=True) return jsonify({"error": "Internal server error occurred"}), 500