Package upgrades and cleanup.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import axios from "axios";
|
||||
import axios, { AxiosError } from "axios";
|
||||
import { BrowserWindow } from "electron";
|
||||
import log from "electron-log";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
@@ -6,6 +6,7 @@ import { promises as fsPromises } from "fs";
|
||||
import path from "path";
|
||||
import { RawJobDataObject } from "../decoder/decoder";
|
||||
import store from "../store/store";
|
||||
import ipcTypes from "../../util/ipcTypes.json";
|
||||
|
||||
// Function to write job object to logs subfolder
|
||||
async function writeJobToLogsFolder(job, fileName): Promise<string> {
|
||||
@@ -110,21 +111,21 @@ async function ScrubEstimate({
|
||||
pdfWindow.focus();
|
||||
return resultPDFUrl;
|
||||
} catch (error) {
|
||||
log.error("Error while scrubbing estimate:", error, error.stack);
|
||||
log.error("Error Response Data:", error.response?.data);
|
||||
const err = error as AxiosError;
|
||||
log.error("Error while scrubbing estimate:", error, err.stack);
|
||||
log.error("Error Response Data:", err.response?.data);
|
||||
const mainWindow = BrowserWindow.getAllWindows()[0];
|
||||
|
||||
if (error.status === 400) {
|
||||
mainWindow.webContents.send(ipcTypes.app.toRenderer.scrubError, {
|
||||
mainWindow.webContents.send(ipcTypes.toRenderer.scrub.scrubError, {
|
||||
message:
|
||||
error.response?.data ||
|
||||
"Error encountered sending estimate to Estimate Scrubber.",
|
||||
});
|
||||
} else if (error.status === 401) {
|
||||
mainWindow.webContents.send(ipcTypes.app.toRenderer.scrubError, {
|
||||
mainWindow.webContents.send(ipcTypes.toRenderer.scrub.scrubError, {
|
||||
message:
|
||||
"Authentication with Estimate Scrubber failed." ||
|
||||
error.response?.data,
|
||||
err.response?.data || "Authentication with Estimate Scrubber failed."ta,
|
||||
});
|
||||
}
|
||||
return "Error: Unable to scrub estimate.";
|
||||
|
||||
Reference in New Issue
Block a user