forked from Yara724/api
Retain inquiry audit context on failure
This commit is contained in:
@@ -421,6 +421,8 @@ export async function runPlateInquiryWithFallback<T>(options: {
|
||||
plateKind: "CURRENT" | "PREVIOUS";
|
||||
attempts: Array<{
|
||||
plateKind: "CURRENT" | "PREVIOUS";
|
||||
plate: InquiryVehicleInputDto["currentPlate"];
|
||||
vin?: string;
|
||||
succeeded: boolean;
|
||||
usable?: boolean;
|
||||
error?: string;
|
||||
@@ -432,6 +434,8 @@ export async function runPlateInquiryWithFallback<T>(options: {
|
||||
let lastError: unknown;
|
||||
const attempts: Array<{
|
||||
plateKind: "CURRENT" | "PREVIOUS";
|
||||
plate: InquiryVehicleInputDto["currentPlate"];
|
||||
vin?: string;
|
||||
succeeded: boolean;
|
||||
usable?: boolean;
|
||||
error?: string;
|
||||
@@ -446,6 +450,8 @@ export async function runPlateInquiryWithFallback<T>(options: {
|
||||
if (!usable) {
|
||||
attempts.push({
|
||||
plateKind: candidate.kind,
|
||||
plate: candidate.plate,
|
||||
...(options.vehicle?.vin ? { vin: options.vehicle.vin } : {}),
|
||||
succeeded: true,
|
||||
usable: false,
|
||||
});
|
||||
@@ -464,6 +470,8 @@ export async function runPlateInquiryWithFallback<T>(options: {
|
||||
}
|
||||
attempts.push({
|
||||
plateKind: candidate.kind,
|
||||
plate: candidate.plate,
|
||||
...(options.vehicle?.vin ? { vin: options.vehicle.vin } : {}),
|
||||
succeeded: true,
|
||||
usable: true,
|
||||
});
|
||||
@@ -477,6 +485,8 @@ export async function runPlateInquiryWithFallback<T>(options: {
|
||||
if (!alreadyRecorded) {
|
||||
attempts.push({
|
||||
plateKind: candidate.kind,
|
||||
plate: candidate.plate,
|
||||
...(options.vehicle?.vin ? { vin: options.vehicle.vin } : {}),
|
||||
succeeded: false,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user