title: Dojo: Failed to reach in error callback when using lang.hitch
body: <p>I'm trying to request the data from server using dojo jsonrest store. While requesting i'm catching the callback to do some stuff. For example <br></p>
  
  <pre><code>this.myStore.get(paramValue).then(lang.hitch(this, function (res) {
                          //do something like this.globalVal = res;
                      }, function (err) {
                          console.log(err);
                          //throw error
                      }));
  </code></pre>
  
  <p>But the above code only works when the request returns success, i.e. it dose enter in the first block of deferred on success return, but when some error occurred, it failed to reach in the <code>error callback</code> and hence i'm not able to catch the errors returned by server. <br> </p>
  
  <p>If i do the above code without using lang.hitch like this <br></p>
  
  <pre><code>this.myStore.get(paramValue).then(function (res) {
                          //do something like this.globalVal = res;
                      }, function (err) {
                          console.log(err);
                          //throw error
                      });
  </code></pre>
  
  <p>Then it works. i.e. it will now reach to the error callback as well and i can throw the appropriate error to user.<br></p>
  
  <p>So why dose this happen, and if lang.hitch is not something that can be  used with deferred then what to use? <br> </p>
  
  <p>Thanks</p>