Only check for errors if the response is a hash/object

This prevents an exception when a normal array is returned.