code: function handler() {
          try {
            if (this.readyState === this.DONE) {
  
              var response = _buildResponse(this, options.fullResponse);
  
              // Resolve or reject promise given the response status.
              // HTTP status of 2xx is considered a success.
              if (this.status >= 200 && this.status < 300) {
  
                if (successCallback) {
                  Logger.warnCallbackDeprecation();
                  successCallback(response);
                }
                resolve(response);
  
              } else {
                errorHandler(response);
              }
            }
          } catch (exception) {
            // Do nothing, will be handled by ontimeout.
          }
        }
docs: Define the response handler.