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

fix: handle auth and server error during swap #593

Merged
merged 7 commits into from
Dec 1, 2022

Conversation

Cafe137
Copy link
Collaborator

@Cafe137 Cafe137 commented Nov 24, 2022

No description provided.

@bee-worker
Copy link
Collaborator

bee-worker commented Nov 24, 2022

🐝 PR preview in Swarm

Preview URL: https://bah5acgzabqbnwqob5ozvrplcb6ncfg54etjgnx2fuu5fut4jqisj47i7b42q.bzz.link
Swarm Hash: 0c02db41c1ebb358bd620f9a229bbc24d266df45a53a5a4f8982249e7d1f0f35
Commit Hash: 943cf76
Commit Message: fix: avoid overwriting daiToSwap when it is set manually

@Cafe137 Cafe137 marked this pull request as ready for review November 25, 2022 09:28
Copy link
Contributor

@AuHau AuHau left a comment

Choose a reason for hiding this comment

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

Generally LGTM, some suggestions which I will leave up to you.

getDesktopConfiguration(desktopUrl),
'Unable to reach Desktop API. Is Swarm Desktop running?',
'Unable to reach Desktop API - Swarm Desktop may not be running or API key is wrong',
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to distinguish if the API key is wrong or Swarm Desktop server is not running, no?

src/utils/net.ts Outdated
@@ -27,6 +27,12 @@ export async function sendRequest(
method,
headers,
data,
}).catch(error => {
if (error?.response?.data) {
throw Error(JSON.stringify(error.response.data))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would provide a bit nicer Error 😅 At least format it like suggested. Maybe include path of the request as well?

Suggested change
throw Error(JSON.stringify(error.response.data))
throw Error(`Request failed! Response: ${JSON.stringify(error.response.data)}`)

@Cafe137 Cafe137 changed the title fix: change execution order for light node upgrade fix: handle auth and server error during swap Dec 1, 2022
@Cafe137 Cafe137 merged commit 665ae06 into master Dec 1, 2022
@Cafe137 Cafe137 deleted the fix/ultra-light-node-execution-order branch December 1, 2022 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants