

export function uploadBinaryProfileData(data, progressChangeCallback = undefined) {
  return new Promise((resolve, reject) => {
    const xhr = new XMLHttpRequest();

    xhr.onload = () => {
      if (xhr.status === 200) {
        resolve(xhr.responseText);
      } else {
        reject(xhr.status);
      }
    };

    xhr.onerror = () => {
      reject(xhr.status);
    };

    xhr.upload.onprogress = e => {
      if (progressChangeCallback && e.lengthComputable) {
        progressChangeCallback(e.loaded / e.total);
      }
    };

    xhr.open('POST', 'https://profile-store.appspot.com/compressed-store');
    xhr.send(data);
  });
}

@@ -288,86 +288,191 @@
 ect(
-xhr.status);%0A      %7D%0A    %7D;%0A%0A    xhr.onerror = () =%3E %7B%0A      reject(xhr.status
+%60xhr onload with status != 200, xhr.statusText: $%7Bxhr.statusText%7D%60);%0A      %7D%0A    %7D;%0A%0A    xhr.onerror = () =%3E %7B%0A      reject(%60xhr onerror was called, xhr.statusText: $%7Bxhr.statusText%7D%60
 );%0A 

Improve error messages when the profile store XHR fails.