Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling refactor #446

Merged
merged 2 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constructor/dsl/dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Parse(ctx context.Context, file string) ([]*job.Workflow, *Error) {
}
defer func() {
if err := f.Close(); err != nil {
log.Printf("%s: could not close %s\n", err.Error(), cleanedPath)
log.Printf("could not close %s: %s\n", cleanedPath, err.Error())
}
}()

Expand Down
4 changes: 2 additions & 2 deletions fetcher/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ func tryAgain(fetchMsg string, thisBackoff *Backoff, err *Error) *Error {

thisBackoff.attempts++
log.Printf(
"%s: retrying fetch for %s after %fs (prior attempts: %d)\n",
errMessage,
"retrying fetch for %s after %fs (prior attempts: %d): %s\n",
fetchMsg,
nextBackoff.Seconds(),
thisBackoff.attempts,
errMessage,
)
time.Sleep(nextBackoff)

Expand Down
4 changes: 2 additions & 2 deletions parser/intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ func (p *Parser) ExpectedOperations(

if len(failedMatches) > 0 {
errString += fmt.Sprintf(
"%s: found matching ops with unsuccessful status %s",
errString,
"found matching ops with unsuccessful status %s: %s",
types.PrettyPrintStruct(failedMatches),
errString,
)
}

Expand Down
6 changes: 3 additions & 3 deletions reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r *Reconciler) wrappedActiveEnqueue(
change.Currency,
BacklogFull,
); err != nil {
log.Printf("%s: reconciliation skipped handling failed\n", err.Error())
log.Printf("reconciliation skipped handling failed: %s\n", err.Error())
}
}
}
Expand All @@ -106,9 +106,9 @@ func (r *Reconciler) wrappedInactiveEnqueue(
) {
if err := r.inactiveAccountQueue(true, accountCurrency, liveBlock, false); err != nil {
log.Printf(
"%s: unable to queue account %s",
err.Error(),
"unable to queue account %s: %s",
types.PrintStruct(accountCurrency),
err.Error(),
)
}
}
Expand Down
5 changes: 4 additions & 1 deletion storage/modules/balance_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,11 @@ func (b *BalanceStorage) UpdateBalance(

if bigNewVal.Sign() == -1 {
return false, fmt.Errorf(
"%s is invalid: %w",
"account balance %s of currency %s for account %s at block %s is invalid: %w",
newVal,
types.PrintStruct(change.Currency),
types.PrintStruct(change.Account),
types.PrintStruct(change.Block),
storageErrs.ErrNegativeBalance,
)
}
Expand Down
4 changes: 2 additions & 2 deletions storage/modules/broadcast_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,9 @@ func (b *BroadcastStorage) performBroadcast(
if err != nil {
// Don't error on broadcast failure, retries will automatically be handled.
log.Printf(
"%s: unable to broadcast transaction %s",
err.Error(),
"unable to broadcast transaction %s: %s",
broadcast.TransactionIdentifier.Hash,
err.Error(),
)

return nil
Expand Down