The Promise reject() static method returns a Promise object that is rejected with a given reason.

    
    function resolved(result) {
      console.log('Resolved');
    }

    function rejected(result) {
      console.error(result);
    }

    Promise.reject(new Error('fail')).then(resolved, rejected);
    // [object Error] { ... }