-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add /v2/owners/:ownerAddress/safes
to gracefully handle errors
#2266
Conversation
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.
Nice. It's good that it still logs when it fails for a given chain.
I believe we should either return all of a user’s Safes or none at all. As a user, if some of my Safes are missing from a request, I would assume that all have been returned and the missing ones are lost. |
@PooyaRaki I think the proposed change is good for two reasons:
|
@katspaugh I agree with you, but I think we should inform users when we’re unable to fetch data from a specific chain due to ongoing issues. Imagine a power user with assets on three different chains—if they see assets on two chains but not the third, they’d likely be confused. If we give them a heads-up about the issue and suggest trying again later, that’s fine. Otherwise, it could be misleading and might hurt their trust in the platform. |
@PooyaRaki, I agree it's important to prioritise clarity for users. However, this approach aligns with the existing behaviour of endpoints that fetch data from every Transaction Service.
As we're fetching data from every chain, if a particular Transaction Service throws, we lack clarity as to whether the user has Safes on that chain, so it's potentially confusing either way. One alternative could be to return What are your thoughts? cc @katspaugh |
Yes, that’s what I was saying—we should display a warning indicating that Safes couldn’t be loaded there. Regarding returning |
An empty array indicates no Safes are owned on a given chain when a request is successful. This PR, however, excludes the chain in question if the request fails. I'd like to emphasise that returning
Let's see what @katspaugh thinks about this, as implementing such changes would require client updates, whereas this PR is intended as a quick fix. |
An empty array if no safes or |
I’d be happy to approve it, provided we ensure that our users are properly notified about the error. As an end user, I wouldn’t want to see my assets disappear simply because certain chains are experiencing issues. |
I've added a v2 endpoint implementing the above. Please lmk what you think, @PooyaRaki @katspaugh |
/v2/owners/:ownerAddress/safes
to gracefully handle errors
/v2/owners/:ownerAddress/safes
to gracefully handle errors/v2/chains/:chainId/owners/:ownerAddress/safes
to gracefully handle errors
/v2/chains/:chainId/owners/:ownerAddress/safes
to gracefully handle errors/v2/owners/:ownerAddress/safes
to gracefully handle errors
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.
Thanks!
Do you think we should copy this behaviour to other endpoints that query all Transaction Services? |
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.
Thanks for patiently addressing all the remarks 💯
This looks like a solid refactor. We should create a task for each part and plan to tackle them. |
Summary
When getting all Safes by owner (
/v1/owners/:ownerAddress/safes
), every Transaction Service is called. Should one or more throw, the request will as well.This adds a new endpoint (
/v2/owners/:ownerAddress/safes
) which returnsnull
for every chain which the Transaction Service threw for.Changes
Promise.allSettled
.