function checkForError(doc) {
  const win = dom.getWindow(doc);
  const text = doc.body.textContent || doc.body.innerText || '';
  const gseError = text.match(/([^\n]+)\nError ([0-9]{3})/);
  if (gseError) {
    return '(Error ' + gseError[2] + ') ' + gseError[1];
  } else if (win.gmail_error) {
    return win.gmail_error + 700;
  } else if (win.rc) {
    return 600 + win.rc % 100;
  } else {
    return null;
  }
}
Checks for error strings returned by the GSE and error variables that
the Gmail server and GFE set on certain errors.
@param {!Document} doc
@suppress {strictMissingProperties} suppression added to enable type checking