-
Notifications
You must be signed in to change notification settings - Fork 58
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
added error logs for avs reader/writer clients #115
Conversation
@@ -119,25 +119,30 @@ func BuildAvsRegistryChainReader( | |||
) (*AvsRegistryChainReader, error) { | |||
contractRegistryCoordinator, err := regcoord.NewContractRegistryCoordinator(registryCoordinatorAddr, ethClient) | |||
if err != nil { | |||
logger.Error("Failed to create contractRegistryCoordinator", "err", 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.
should we rather wrap the error with informative text and then return it and not log here? reason it's client responsibility to log errors otherwise we have too many logs?
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.
Yeah I was thinking so too. But we've been doing it this way everywhere else so wanted to stay consistent. Shall we change it everywhere?
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.
yea we should maybe do this ? https://pkg.go.dev/errors#Join
for ex: errors.Join(errors.new("Failed to create contractRegistryCoordinator", 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.
I agree with @shrimalmadhur , you should return the wrapped error and the client should handle it.
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.
yea we should maybe do this ? https://pkg.go.dev/errors#Join
for ex:
errors.Join(errors.new("Failed to create contractRegistryCoordinator", err))
join literally concatenates the error strings with a newline in between, such that printing them prints the 2 errors on two separate lines. Is that fine with you @uri-lightblocks ? I know you didn't like the newlines in avs-sync.
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.
ok changed here: 856915e
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.
I prefer to have the error string concatenated without a newline.
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.
@uri-lightblocks tell me more man. How would you concatenate it? With a space in between? A tilda? A "-"? :)
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.
@shrimalmadhur you already had a wrapError function which concatenates with a ":". I made it public and changed everywhere to use it in 33eac92
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.
Let's get this merged. At least now we can easily change it whenever.
some avs teams who are forking our clients and remove some contracts such as the apkRegistry end up with bugs here, and the errors were not informative, so added logging lines for them.