Fix reporting of sucess and status for apply fix

Res is undefined when throwingErrorCallback throws error.
We need to parse status code from error.message

Release-Notes: skip
Change-Id: I611cb0cbb8ae81f6ed1d4089bd65559145651f76
diff --git a/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts b/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts
index 6431f5c..7ce0b3d 100644
--- a/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts
+++ b/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts
@@ -278,6 +278,7 @@
     this.reporting.time(Timing.APPLY_FIX_LOAD);
     let res: Response | undefined = undefined;
     let errorText = '';
+    let status = '';
     try {
       res = await this.restApiService.applyFixSuggestion(
         changeNum,
@@ -289,6 +290,7 @@
     } catch (error) {
       if (error instanceof Error) {
         errorText = error.message;
+        status = errorText.match(/\b\d{3}\b/)?.[0] || '';
       }
       fireError(this, `Applying Fix failed.\n${errorText}`);
     } finally {
@@ -299,8 +301,8 @@
           fixSuggestion?.replacements?.[0].path ?? ''
         ),
         commentId: this.commentId ?? '',
-        success: res?.ok,
-        status: res?.status,
+        success: res?.ok ?? false,
+        status: res?.status ?? status,
         errorText,
       });
     }