Skip to content

Commit

Permalink
Fix error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Feb 20, 2024
1 parent 69edfd4 commit 71a3914
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions multiepoch-getTransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (multi *MultiEpoch) findEpochNumberFromSignature(ctx context.Context, sig s
continue
}
if has, err := bucket.Has(sig); err != nil {
return 0, fmt.Errorf("failed to check if signature exists in bucket: %v", err)
return 0, fmt.Errorf("failed to check if signature exists in bucket: %w", err)
} else if has {
found = append(found, epochNumber)
}
Expand All @@ -81,7 +81,7 @@ func (multi *MultiEpoch) findEpochNumberFromSignature(ctx context.Context, sig s
wg.Spawn(func() (any, error) {
epoch, err := multi.GetEpoch(epochNumber)
if err != nil {
return nil, fmt.Errorf("failed to get epoch %d: %v", epochNumber, err)
return nil, fmt.Errorf("failed to get epoch %d: %w", epochNumber, err)
}
if _, err := epoch.FindCidFromSignature(ctx, sig); err == nil {
return epochNumber, nil
Expand Down Expand Up @@ -118,7 +118,7 @@ func (multi *MultiEpoch) handleGetTransaction(ctx context.Context, conn *request
return &jsonrpc2.Error{
Code: jsonrpc2.CodeInvalidParams,
Message: "Invalid params",
}, fmt.Errorf("failed to parse params: %v", err)
}, fmt.Errorf("failed to parse params: %w", err)
}
if err := params.Validate(); err != nil {
return &jsonrpc2.Error{
Expand All @@ -137,12 +137,12 @@ func (multi *MultiEpoch) handleGetTransaction(ctx context.Context, conn *request
return &jsonrpc2.Error{
Code: CodeNotFound,
Message: "Transaction not found",
}, fmt.Errorf("failed to find epoch number from signature %s: %v", sig, err)
}, fmt.Errorf("failed to find epoch number from signature %s: %w", sig, err)
}
return &jsonrpc2.Error{
Code: jsonrpc2.CodeInternalError,
Message: "Internal error",
}, fmt.Errorf("failed to get epoch for signature %s: %v", sig, err)
}, fmt.Errorf("failed to get epoch for signature %s: %w", sig, err)
}
klog.V(4).Infof("Found signature %s in epoch %d in %s", sig, epochNumber, time.Since(startedEpochLookupAt))

Expand All @@ -166,7 +166,7 @@ func (multi *MultiEpoch) handleGetTransaction(ctx context.Context, conn *request
return &jsonrpc2.Error{
Code: jsonrpc2.CodeInternalError,
Message: "Internal error",
}, fmt.Errorf("failed to get Transaction: %v", err)
}, fmt.Errorf("failed to get Transaction: %w", err)
}
{
conn.ctx.Response.Header.Set("DAG-Root-CID", transactionCid.String())
Expand All @@ -181,7 +181,7 @@ func (multi *MultiEpoch) handleGetTransaction(ctx context.Context, conn *request
return &jsonrpc2.Error{
Code: jsonrpc2.CodeInternalError,
Message: "Internal error",
}, fmt.Errorf("failed to get block: %v", err)
}, fmt.Errorf("failed to get block: %w", err)
}
blocktime := uint64(block.Meta.Blocktime)
if blocktime != 0 {
Expand All @@ -199,7 +199,7 @@ func (multi *MultiEpoch) handleGetTransaction(ctx context.Context, conn *request
return &jsonrpc2.Error{
Code: jsonrpc2.CodeInternalError,
Message: "Internal error",
}, fmt.Errorf("failed to decode transaction: %v", err)
}, fmt.Errorf("failed to decode transaction: %w", err)
}
response.Signatures = tx.Signatures
if tx.Message.IsVersioned() {
Expand All @@ -214,7 +214,7 @@ func (multi *MultiEpoch) handleGetTransaction(ctx context.Context, conn *request
return &jsonrpc2.Error{
Code: jsonrpc2.CodeInternalError,
Message: "Internal error",
}, fmt.Errorf("failed to encode transaction: %v", err)
}, fmt.Errorf("failed to encode transaction: %w", err)
}
response.Transaction = encodedTx
}
Expand Down

0 comments on commit 71a3914

Please sign in to comment.