TODO: move this to utils reject with an error after so many milliseconds
function rejectAfter (milliseconds, errorMessage) {
  return new Promise((resolve, reject) => {
    later(reject, new Error(errorMessage), milliseconds);
  });
}