title: Firebase catch exception
body: <p>I have the following code that is throwing me some firebase exception in the console if the data that I want to save to firebase is invalid. 
  I want to catch it and display it to the screen in a controlled manner rather than finding out from console. 
  I dont know why my .catch is not catching any of the firebase exceptions?</p>
  
  <pre><code>this.databaseService.saveCodesToFirebase(jsonFromCsv)
    .then(result =&gt; {
      this.alertService.alertPopup('Success', 'Code Updated')
    })
    .catch(error =&gt; {
      this.errorMessage = 'Error - ' + error.message
    })
  
  
  saveCodesToFirebase(myObj: Object) {
      let ref = firebase.database().ref();
  
      let path = this.userService.getCurrentUser().companyId + '/codes/'
      let lastUpdatedPath = this.userService.getCurrentUser().companyId + '/lastUpdated/';
  
      var updates = {}
  
      updates[path] = jobObject;
      updates[lastUpdatedPath] = Math.round(new Date().getTime() / 1000);
  
      return ref.child('codes').update(updates);
  }
  </code></pre>
  
  <blockquote>
    <p>EXCEPTION: Firebase.update failed: First argument  contains an invalid key () in property 'codes.apple20170318.codes'.  Keys must be
    non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/mAVjE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mAVjE.png" alt="screen shot"></a></p>