Clean up typing and comments in fetch method

The response return from scheduled fetch can't be null (or an error
would be thrown), so we can remove that condition when logging.

Google-Bug-Id: b/297849592
Release-Notes: skip
Change-Id: I7d2aba92642ba559b6c32473188cbb7c33cf5f66
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
index 09a2c66..a5280d4 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
@@ -223,7 +223,7 @@
     private readonly writeScheduler: Scheduler<Response>
   ) {}
 
-  private schedule(method: string, task: Task<Response>) {
+  private schedule(method: string, task: Task<Response>): Promise<Response> {
     if (method === 'PUT' || method === 'POST' || method === 'DELETE') {
       return this.writeScheduler.schedule(task);
     } else {
@@ -236,18 +236,17 @@
    * with timing and logging.
    */
   fetch(req: FetchRequest): Promise<Response> {
-    const method =
-      req.fetchOptions && req.fetchOptions.method
-        ? req.fetchOptions.method
-        : 'GET';
-    const start = Date.now();
+    const method = req.fetchOptions?.method ?? HttpMethod.GET;
+    const startTime = Date.now();
     const task = async () => {
       const res = await this._auth.fetch(req.url, req.fetchOptions);
+      // Check for "too many requests" error and throw RetryError to cause a
+      // retry in this case, if the scheduler attempts retries.
       if (!res.ok && res.status === 429) throw new RetryError<Response>(res);
       return res;
     };
 
-    const xhr = this.schedule(method, task).catch((err: unknown) => {
+    const resPromise = this.schedule(method, task).catch((err: unknown) => {
       if (err instanceof RetryError) {
         return err.payload;
       } else {
@@ -256,9 +255,9 @@
     });
 
     // Log the call after it completes.
-    xhr.then(res => this._logCall(req, start, res ? res.status : null));
-    // Return the XHR directly (without the log).
-    return xhr;
+    resPromise.then(res => this.logCall(req, startTime, res.status));
+    // Return the response directly (without the log).
+    return resPromise;
   }
 
   /**
@@ -273,7 +272,7 @@
    *     is used here rather than the response object so there is no way this
    *     method can read the body stream.
    */
-  _logCall(req: FetchRequest, startTime: number, status: number | null) {
+  logCall(req: FetchRequest, startTime: number, status: number) {
     const method =
       req.fetchOptions && req.fetchOptions.method
         ? req.fetchOptions.method