~thomir-deactivatedaccount/adt-cloud-service/trunk-fix-httperror-issue

« back to all changes in this revision

Viewing changes to adt_cloud_service/image.py

  • Committer: Ubuntu CI Bot
  • Author(s): Thomi Richards
  • Date: 2015-03-16 18:34:10 UTC
  • mfrom: (10.2.4 trunk)
  • Revision ID: ubuntu_ci_bot-20150316183410-gpwfie2xmf4l50mx
Bugfixes. [r=Parameswaran Sivatharman]

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    data = None
63
63
    try:
64
64
        data = json.loads(probably_json.decode())
 
65
    except UnicodeDecodeError as e:
 
66
        raise ImageMapperError(
 
67
            "Unable to decode image-mapper response to unicode: {}".format(str(e)),
 
68
            "Data from image-mapper is: {}".format(probably_json.decode('unicode_escape'))
 
69
        )
65
70
    except Exception as e:
66
 
        raise ImageMapperError("Error while decoding image-mapper response: {}".format(str(e)))
 
71
        raise ImageMapperError(
 
72
            "Error while decoding image-mapper response: {}".format(str(e)),
 
73
            "Data from image-mapper is: {}".format(probably_json)
 
74
        )
67
75
    if status == 200:
68
76
        return data['image_name']
69
77
    else: