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

added error logs for avs reader/writer clients #115

Merged
merged 3 commits into from
Feb 14, 2024

Conversation

samlaf
Copy link
Collaborator

@samlaf samlaf commented Feb 13, 2024

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.

@@ -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)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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?

Copy link
Collaborator

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))

Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok changed here: 856915e

Copy link
Contributor

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.

Copy link
Collaborator Author

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 "-"? :)

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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.

@samlaf samlaf requested a review from shrimalmadhur February 14, 2024 01:45
@samlaf samlaf merged commit b72af28 into master Feb 14, 2024
3 checks passed
@samlaf samlaf deleted the better-error-logs-for-clients branch February 14, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants