Improve error messages for clarity and consistency in InvoiceOutValidationResource

This commit is contained in:
dhanabalan
2025-11-08 17:51:12 +05:30
parent 317e877255
commit 3291c47d2c

View File

@@ -394,12 +394,12 @@ class InvoiceOutValidationResource extends Resource
$scannedBy = trim($row[4]);
if (empty($qrcode)) {
throw new \Exception("Missing QR Code");
throw new \Exception("Row '{$rowNumber}' Missing QR Code");
}
$plant = Plant::where('code', $plantCode)->first();
if (!$plant) {
throw new \Exception("Invalid plant code: {$plantCode}");
throw new \Exception("Invalid plant code : '{$plantCode}'");
}
$formattedDate = null;
@@ -416,7 +416,7 @@ class InvoiceOutValidationResource extends Resource
->format('Y-m-d H:i:s');
}
} catch (\Exception $e) {
throw new \Exception("Invalid date format: {$scannedAt}");
throw new \Exception("Invalid date format : '{$scannedAt}'");
}
}
@@ -456,12 +456,11 @@ class InvoiceOutValidationResource extends Resource
}
$successCount++;
} catch (\Exception $e) {
$failedRecords[] = [
'row' => $rowNumber,
'qrcode' => $qrcode ?? null,
'error' => $e->getMessage(),
'error' => $e->getMessage()
];
}
}