fix(bookin): corrected the error received from the book in fail

This commit is contained in:
2025-08-25 14:38:00 -05:00
parent 68901a857a
commit 369d16018c
2 changed files with 16 additions and 1 deletions

View File

@@ -96,7 +96,7 @@ export const bookInLabel = async (data: any) => {
"ocp", "ocp",
`${ `${
data.printer ? data.printer[0].name : "Manual book in" data.printer ? data.printer[0].name : "Manual book in"
}, "Error: ${error}` }, "Error: ${error?.response.data}`
); );
// console.log(error.response.data); // console.log(error.response.data);
return { return {

View File

@@ -12,6 +12,7 @@ import { bookInLabel } from "./bookIn.js";
import { delieryInhouse } from "../specialProcesses/inhouse/inhouseDelivery.js"; import { delieryInhouse } from "../specialProcesses/inhouse/inhouseDelivery.js";
import { dualPrintingProcess } from "../specialProcesses/dualPrinting/dualPrinting.js"; import { dualPrintingProcess } from "../specialProcesses/dualPrinting/dualPrinting.js";
import { getMac } from "../../utils/getMachineId.js"; import { getMac } from "../../utils/getMachineId.js";
import { success } from "zod/v4";
interface Printer { interface Printer {
name: string; name: string;
@@ -283,6 +284,20 @@ export const labelingProcess = async ({
// will add later!!! :P // will add later!!! :P
} }
if (!book.success) {
// createLog(
// "error",
// "labeling",
// "ocp",
// `Error Booking in label: ${book.errors[0].message}`
// );
return {
success: false,
message: `Error Booking in label: ${book.errors[0].message}`,
data: book,
};
}
// inhouse - if the inhouse funtion is turned on we will deliver to inhouse as long as we did not hit an error state // inhouse - if the inhouse funtion is turned on we will deliver to inhouse as long as we did not hit an error state
const inhouseDelivery = settingData.filter( const inhouseDelivery = settingData.filter(
(s) => s.name === "inhouseDelivery" (s) => s.name === "inhouseDelivery"