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

chore: add try catch when parsing stream response #1839

Merged
merged 11 commits into from
Mar 8, 2024

Conversation

Torres-ssf
Copy link
Contributor

@Torres-ssf Torres-ssf commented Mar 6, 2024

Adding this because of: ccb706e

The stream text data response was slightly modified on fuel-core 0.23.0 resulting in an error being thrown without much context.

With this, we can avoid lost time debugging it in the future if that happens again.

UPDATE:

The stream text data response did not change. The problem was another data: present on the text data, resulting in the String.split not working as expected.

@Torres-ssf Torres-ssf added the chore Issue is a chore label Mar 6, 2024
@Torres-ssf Torres-ssf self-assigned this Mar 6, 2024
arboleya
arboleya previously approved these changes Mar 6, 2024
Copy link
Member

@arboleya arboleya left a comment

Choose a reason for hiding this comment

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

Can we somehow provoke this error and have a test for this?

EDIT: This sort of thing (ccb706e) should ideally be done with a RegExp instead of split/[n] or other string manipulation workarounds.

Dhaiwat10
Dhaiwat10 previously approved these changes Mar 6, 2024
arboleya
arboleya previously approved these changes Mar 7, 2024
Copy link
Contributor

@nedsalk nedsalk left a comment

Choose a reason for hiding this comment

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

Good stuff. I requested changes for test simplification.

packages/account/src/providers/provider.test.ts Outdated Show resolved Hide resolved
@Torres-ssf Torres-ssf force-pushed the st/fix/add-try-catch-when-parsing-stream-response branch from f1a8e54 to 4ee0b6f Compare March 8, 2024 17:20
Copy link
Contributor

github-actions bot commented Mar 8, 2024

Coverage Report:

Lines Branches Functions Statements
79.48%(+0.02%) 70.29%(+0.09%) 78.04%(+0%) 79.57%(+0.03%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/fuel-graphql-subscriber.ts 96%
(+4.7%)
87.5%
(+25%)
100%
(+0%)
96%
(+4.7%)

@Torres-ssf Torres-ssf merged commit 468b4cf into master Mar 8, 2024
13 checks passed
@Torres-ssf Torres-ssf deleted the st/fix/add-try-catch-when-parsing-stream-response branch March 8, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants