Error handling
parse() throws a Silarhi\Caf\Exceptions\ParseException when:
- the content has no LA44ZZ payment table (fewer than four 121-dash borders), such as an empty string or another file
- a row does not have the expected columns
- an amount, in a row or in the total, is malformed:
1.298.50,ABCor an empty amount (see parsing for the accepted formats) - a date, in a row or in the header, is invalid or out of range:
13 2021or31 02 2021are rejected instead of being rolled over
use Silarhi\Caf\Exceptions\ParseException;
try { $paymentSlip = $parser->parse($content);} catch (ParseException $e) { // Not a LA44ZZ payment slip, malformed row, malformed amount or invalid date}The parser never returns a partial result: one bad row rejects the whole file. Missing metadata is not an error, the
getter returns null (see parsing).
Messages
Section titled “Messages”| Cause | Message |
|---|---|
| No payment table | Input CAF LA44 could not be parsed |
| Malformed or empty row | CAF Row n°2 could not be parsed |
| Invalid date in a row | CAF Row n°2 : "13 2025" date value could not be parsed, expected format is "m Y" |
| Invalid header date | "31 02 2021" date value could not be parsed, expected format is "d m Y" |
| Invalid amount in a row | CAF Row n°2 : "1.298.50" amount value could not be parsed |
| Invalid total | "1.298.50" amount value could not be parsed |
Row numbers count from 1 at the first row of the table, not from the top of the file. An empty table fails on row 1.
Malformed row
Section titled “Malformed row”The second row of this table misses the : between its deduction and its net amount:
// Silarhi\Caf\Exceptions\ParseException$e->getMessage(); // "CAF Row n°2 could not be parsed" ------------------------------------------------------------------------------------------------------------------------- : REFERENCES : NUMERO : NOM DESTINATAIRE : DATE : DATE : MONTANT : RETENUE : MONTANT : : LOGEMENT/PRET :ALLOCATAIRE: : DEBUT : FIN : BRUT : : NET : ------------------------------------------------------------------------------------------------------------------------- : : 1234567 A : MME EXEMPLE ALICE : 01 2026 : 01 2026 : 312,00: 0,00: 312,00 : : 0000000000000 : 2345678 B : MR EXEMPLE BRUNO : 12 2025 : 01 2026 : 225,50: 25,50 200,00 : : : 3456789 C : MME EXEMPLE CHLOE : 01 2026 : 01 2026 : 88,00: 0,00: 88,00 : ------------------------------------------------------------------------------------------------------------------------- : TOTAL : 600,00 : -------------------------------------------------------------------------------------------------------------------------Invalid date in a row
Section titled “Invalid date in a row”The second row starts in month 13. The exception wraps the date error, available from getPrevious():
// Silarhi\Caf\Exceptions\ParseException$e->getMessage(); // 'CAF Row n°2 : "13 2025" date value could not be parsed, expected format is "m Y"'$e->getPrevious()->getMessage(); // '"13 2025" date value could not be parsed, expected format is "m Y"' ------------------------------------------------------------------------------------------------------------------------- : REFERENCES : NUMERO : NOM DESTINATAIRE : DATE : DATE : MONTANT : RETENUE : MONTANT : : LOGEMENT/PRET :ALLOCATAIRE: : DEBUT : FIN : BRUT : : NET : ------------------------------------------------------------------------------------------------------------------------- : : 1234567 A : MME EXEMPLE ALICE : 01 2026 : 01 2026 : 312,00: 0,00: 312,00 : : 0000000000000 : 2345678 B : MR EXEMPLE BRUNO : 13 2025 : 01 2026 : 225,50: 25,50: 200,00 : : : 3456789 C : MME EXEMPLE CHLOE : 01 2026 : 01 2026 : 88,00: 0,00: 88,00 : ------------------------------------------------------------------------------------------------------------------------- : TOTAL : 600,00 : -------------------------------------------------------------------------------------------------------------------------Invalid amount
Section titled “Invalid amount”The net amount of the second row uses a dot both as thousands and decimal separator. Like a date error, the exception wraps the amount error:
// Silarhi\Caf\Exceptions\ParseException$e->getMessage(); // 'CAF Row n°2 : "1.298.50" amount value could not be parsed'$e->getPrevious()->getMessage(); // '"1.298.50" amount value could not be parsed' ------------------------------------------------------------------------------------------------------------------------- : REFERENCES : NUMERO : NOM DESTINATAIRE : DATE : DATE : MONTANT : RETENUE : MONTANT : : LOGEMENT/PRET :ALLOCATAIRE: : DEBUT : FIN : BRUT : : NET : ------------------------------------------------------------------------------------------------------------------------- : : 1234567 A : MME EXEMPLE ALICE : 01 2026 : 01 2026 : 312,00: 0,00: 312,00 : : 0000000000000 : 2345678 B : MR EXEMPLE BRUNO : 12 2025 : 01 2026 : 1.323,50: 25,50: 1.298.50 : : : 3456789 C : MME EXEMPLE CHLOE : 01 2026 : 01 2026 : 88,00: 0,00: 88,00 : ------------------------------------------------------------------------------------------------------------------------- : TOTAL : 600,00 : -------------------------------------------------------------------------------------------------------------------------