Skip to content

Commit

Permalink
Handle account not found exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ushitora-anqou committed Oct 15, 2023
1 parent 5fb115f commit e834fbe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/sql_writer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,12 @@ let dump_transaction_records_and_posting_records (model : Model.t)
(tx.postings
|> List.mapi (fun i (p : Model.posting) ->
let ps_id = List.length ps_recs + i in
let account_name = list_last p.account in
let acc_id =
account_id_map |> StringMap.find (list_last p.account)
try account_id_map |> StringMap.find account_name
with Not_found ->
failwith
(Printf.sprintf "account not found: %s" account_name)
in
(ps_id, acc_id, tx_id, Option.get p.amount, p.narration)))
@ ps_recs
Expand Down

0 comments on commit e834fbe

Please sign in to comment.