Closed pashagolub closed 11 months ago
I'd go with such a solution
func SyncJournal(db *gorm.DB) error {
AutoMigrate(db)
log.Info("Syncing transactions from journal")
prices, err := ledger.Cli().Prices(config.GetJournalPath())
if err != nil {
return err
}
price.UpsertAllByType(db, config.Unknown, prices)
postings, err := ledger.Cli().Parse(config.GetJournalPath(), prices)
if err != nil {
return err
}
posting.UpsertAll(db, postings)
}
if I have any syntax error in the journal and try to Sync Journal the application fails with FATAL level
If one runs an application it crashes with ugly error box. If one is running CLI version the front-end is always showin progress indication, while the back-end is dead.
Solution: produce a regular error and proceed without terminating application