Check that response.error exists before using it

This should fix an annoying problem which happens if
* You have the chrome developer toolbar open
* It is set to pause on errors
* You refresh or navigate away while there is running ajax request

Change-Id: I349a7b956e34f0f07e071c27ecf8e14455200c18
Merge "Check that response.error exists before using it"