-
Notifications
You must be signed in to change notification settings - Fork 13
Remove DB error details from the RPC handler response #124
Conversation
Quality Gate passedIssues Measures |
return "0x0", jRPC.NewRPCError(jRPC.DefaultErrorCode, fmt.Sprintf("failed to execute tx: %s", err)) | ||
} | ||
|
||
// Send L1 tx | ||
dbTx, err := i.db.BeginStateTransaction(ctx) | ||
if err != nil { | ||
return "0x0", jRPC.NewRPCError(jRPC.DefaultErrorCode, fmt.Sprintf("failed to begin dbTx, error: %s", err)) | ||
log.Errorf("failed to begin dbTx, error: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every time it returns here, will log an error, so this is redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily, it returns a short error without details but logs the full error message. It was the main idea of this PR.
return "0x0", jRPC.NewRPCError(jRPC.DefaultErrorCode, fmt.Sprintf("failed to commit dbTx, error: %s", err)) | ||
|
||
if err = dbTx.Commit(ctx); err != nil { | ||
log.Errorf("failed to commit dbTx, error: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every time it returns here, will log an error, so this is redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.