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

Fixed token setup error handling #249

Merged
merged 5 commits into from
Jan 10, 2022

Conversation

seitau
Copy link
Contributor

@seitau seitau commented Dec 26, 2021

Fixed error handling of Setup function of token service which was causing panic when specified account address was not found in db.

wallet-api-1  | time="2021-12-26T08:49:12Z" level=warning msg="Error while handling request" error="error while getting new transaction: error while building transaction: error while getting user authorizer: client: rpc error: code = NotFound desc = could not find account with address 01cf0e2f2f715450"
wallet-api-1  | time="2021-12-26T08:49:12Z" level=info msg="HTTP request" duration=17.016 method=POST path="/v1/accounts/0x01cf0e2f2f715450/non-fungible-tokens/TestToken?sync=" remote="172.20.0.1:58168" size=203 status=400 user-agent=axios/0.24.0
wallet-api-1  | panic: runtime error: invalid memory address or nil pointer dereference
wallet-api-1  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb819e3]
wallet-api-1  |
wallet-api-1  | goroutine 717 [running]:
wallet-api-1  | github.com/flow-hydraulics/flow-wallet-api/jobs.(*Job).Wait(0x0, 0x0)
wallet-api-1  |     /build/jobs/jobs.go:86 +0x43
wallet-api-1  | github.com/flow-hydraulics/flow-wallet-api/tokens.(*Service).Setup.func1()
wallet-api-1  |     /build/tokens/service.go:78 +0x6c
wallet-api-1  | created by github.com/flow-hydraulics/flow-wallet-api/tokens.(*Service).Setup
wallet-api-1  |     /build/tokens/service.go:76 +0x2d9

@seitau seitau changed the title add token setup test Fixed token setup error handling Dec 26, 2021
@seitau seitau force-pushed the fix-token-setup branch 9 times, most recently from a9d2ba2 to 0c8f51a Compare December 27, 2021 01:30
@nanuuki nanuuki self-requested a review January 4, 2022 09:07
@nanuuki nanuuki added the bug Something isn't working label Jan 4, 2022
Copy link
Contributor

@nanuuki nanuuki left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @seita-uc! Please see the comments below :)

tests/tokens_service_test.go Outdated Show resolved Hide resolved
tests/tokens_service_test.go Outdated Show resolved Hide resolved
tests/tokens_service_test.go Outdated Show resolved Hide resolved
tests/tokens_service_test.go Outdated Show resolved Hide resolved
tests/tokens_service_test.go Show resolved Hide resolved
@seitau
Copy link
Contributor Author

seitau commented Jan 5, 2022

@nanuuki Thank you for the review. Updated according to your comments.

@seitau seitau requested a review from nanuuki January 5, 2022 15:37
@seitau
Copy link
Contributor Author

seitau commented Jan 6, 2022

It seems that original error was fixed in 2c9e1de.
I will leave this PR open so please merge if adding some tests would help :)

@nanuuki nanuuki merged commit fc9aae2 into flow-hydraulics:main Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants