title: Catching promise rejections
body: <p>I have the following functions:</p>
  
  <p>A thrid party promisified search(id) function taking an ID returning a promise and a data object with the results</p>
  
  <p>I am wrapping that in a checkItemExists(id) function that runs a search(id) and returns true or false if it finds results.</p>
  
  <p>This checkItemExists(id) function is wrapped by another function validateID(id) that performs some form logic such as enabling forms etc if the item is unique.</p>
  
  <pre><code>validateID(id) =&gt; {
    checkItemExists(id).then((response) =&gt; {
      if (response) {
        // perform some logic
      } else {
        // perform some logic
      }
    }).catch (err) {
      // catch the error, handle and log it
    }
  }
  
  checkItemExists (id) =&gt; {
    // third party promisified search function
    search(id).then((response) =&gt; response {
      const itemsFound = response.data.listItems.items.length
      itemExists = itemsFound &gt; 0 ? true : false 
      return Promise.resolve(itemExists)
    }).catch(err) =&gt; {
      console.log("In check item exists")
      return Promise.reject(err)
    }
  }
  </code></pre>
  
  <p>If I pass an empty id to the search function it returns a rejected promise.
  This promise makes it to the catch block of checkItemExists and logs out "In check item exists".</p>
  
  <p>However it also raises a "Possible Unhandled Promise Rejection" error and doesn't pass the rejection all the way up to validateID which is where I would like to handle it.</p>
  
  <p>If I wanted to have all error handling in validateID, what am I missing?</p>