fix(package): the IIF export keeps its typed refusal
`export_iif` turned `journal_to_iif`'s refusal into a string, so a caller could not tell why the file was refused without reading the message. An entry on more than one receivable or payable account is BS-format-10's own refusal (the receiving program will not take the transaction), while every other IIF refusal is BS-format-2's; the bookspec adapter must name the one rule an example expects. Returning `IifError` keeps the two apart by type. The package and the MCP tool still hand the human a string. Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
1 parent
d59eca0c1a
commit
9c299eb768
3 files changed
+4
-4
No files matched your search
@@ -38,7 +38,7 @@ pub fn export_iif(
|
||||
ledger: &Ledger,
|
||||
cash_codes: &[String],
|
||||
as_of: NaiveDate,
|
||||
) -> Result<ledger_import::Iif, String> {
|
||||
) -> Result<ledger_import::Iif, ledger_import::IifError> {
|
||||
use ledger_import::{QbAccountType as Qb, iif_accounts, iif_classes, journal_to_iif};
|
||||
let fixed: std::collections::HashSet<AccountId> = ledger
|
||||
.registered_assets()
|
||||
@@ -71,5 +71,5 @@ pub fn export_iif(
|
||||
.posted_entries()
|
||||
.filter(|e| e.date() <= as_of && !closes.contains(&e.id()))
|
||||
.collect();
|
||||
journal_to_iif(&accounts, &iif_classes(ledger), &entries).map_err(|e| e.to_string())
|
||||
journal_to_iif(&accounts, &iif_classes(ledger), &entries)
|
||||
}
|
||||
Reference in new issue
Block a user