fixed missing data key error

When an error response is set the 'data' key does not appear to be set raising an error.