code: function(handleOrName, session, req) {
          var win,
              errorMsg;
  
          // Fetch the right window
          win = handleOrName === null ?
              session.getCurrentWindow() :       //< current window
              session.getWindow(handleOrName);   //< window by handle
          if (win !== null) {
              return win;
          }
  
          errorMsg = handleOrName === null ?
              "Currently Window handle/name is invalid (closed?)" :
              "Window handle/name '"+handleOrName+"' is invalid (closed?)";
  
          // Report the error throwing the appropriate exception
          throw _errors.createFailedCommandEH(_errors.FAILED_CMD_STATUS_CODES.NoSuchWindow, errorMsg, req, session);
      }
docs: private: