code: function chooseViewForRoute() {
              var allParams = addExtraParamsTo(params,
                  layoutDelegate,
                  clientRequest,
                  clientResponse
              );
  
              return promisify(originalHandler).apply(router, allParams)
                  .then(function(view) {
                      validateView(view);
  
                      return {
                          view: view,
                          reason: null
                      };
                  })
                  .catch(function(reason) {
                      return {
                          view: null,
                          reason: reason
                      };
                  });
          }
docs: If handler returns a view, this function returns a promise of a view If handler returns a promise of a view, this function returns a promise of a view and absorbs the state of the returned promise