function tetheredGetNumber(resolve, reject) {
  try {
    setTimeout(function () {
      const randomInt = Date.now();
      const value = randomInt % 10;
      try {
        if (value >= THRESHOLD_A) {
          throw new Error(`Too large: ${value}`);
        }
      } catch (msg) {
        reject(`Error in callback ${msg}`);
      }
      resolve(value);
      return;
    }, 500);
    // To experiment with error at set-up, uncomment the following 'throw'.
    // throw new Error("Bad setup");
  } catch (err) {
    reject(`Error during setup: ${err}`);
  }
  return;
}
// can use zero 0 to guarantee error
can use zero 0 to guarantee error
can use zero 0 to guarantee error
function tetheredGetNumber(resolve, reject) {
  try {
    setTimeout(function () {
      const randomInt = Date.now();
      const value = randomInt % 10;
      try {
        if (value >= THRESHOLD_A) {
          throw new Error(`Too large: ${value}`);
        }
      } catch (msg) {
        reject(`Error in callback ${msg}`);
      }
      resolve(value);
      return;
    }, 500);
  } catch (err) {
    reject(`Error during setup: ${err}`);
  }
  return;
}
function tetheredGetNumber ( resolve , reject ) { try { setTimeout ( function ( ) { const randomInt = Date . now ( ) ; const value = randomInt % 10 ; try { if ( value >= THRESHOLD_A ) { throw new Error ( ` ${ value } ` ) ; } } catch ( msg ) { reject ( ` ${ msg } ` ) ; } resolve ( value ) ; return ; } , 500 ) ; } catch ( err ) { reject ( ` ${ err } ` ) ; } return ; }
can use zero 0 to guarantee error
can use zero 0 to guarantee error
// To experiment with error at set-up, uncomment the following 'throw'. // throw new Error("Bad setup");