[go: nahoru, domu]

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

Explain how to catch errors on 'Work with WebSockets' page #8765

Open
JadKHaddad opened this issue May 26, 2023 · 2 comments
Open

Explain how to catch errors on 'Work with WebSockets' page #8765

JadKHaddad opened this issue May 26, 2023 · 2 comments
Labels
a.cookbook Relates to a cookbook recipe or guide d.enhancement Improves docs with specific ask e2-days Effort: < 5 days p2-medium Necessary but not urgent concern. Resolve when possible. t.networking Relates to networking within an app

Comments

@JadKHaddad
Copy link

Page URL

https://docs.flutter.dev/cookbook/networking/web-sockets/

Page source

https://github.com/flutter/website/tree/main/src/cookbook/networking/web-sockets.md

Describe the problem

Connection errors while establishing a connection with WebSocketChannel.connect() can't be handeled with try/catch blocks.

Expected fix

No response

Additional context

Establishing connections to a none available server causes my app to crash even though I am trying to catch the error in a try/catch block

@darshankawar darshankawar added st.triage.triage-team Triage team reviewing and categorizing the issue d: api docs p2-medium Necessary but not urgent concern. Resolve when possible. e0-minutes Effort: < 60 min and removed st.triage.triage-team Triage team reviewing and categorizing the issue labels May 26, 2023
@atsansone atsansone added a.cookbook Relates to a cookbook recipe or guide t.networking Relates to networking within an app and removed d: api docs labels May 26, 2023
@atsansone atsansone changed the title [PAGE ISSUE]: 'Work with WebSockets' Explain how to catch errors on 'Work with WebSockets' page May 26, 2023
@atsansone atsansone added d.enhancement Improves docs with specific ask ltw-triage e2-days Effort: < 5 days and removed e0-minutes Effort: < 60 min labels May 26, 2023
@JadKHaddad
Copy link
Author

Tracking progress on dart-lang/web_socket_channel#268

@JadKHaddad
Copy link
Author
WebSocketChannel channel = WebSocketChannel.connect(
    Uri.parse('ws://localhost:8000/ws'),
);

try {
    await channel.ready;
} catch (e) {
    print("Exception: $e");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a.cookbook Relates to a cookbook recipe or guide d.enhancement Improves docs with specific ask e2-days Effort: < 5 days p2-medium Necessary but not urgent concern. Resolve when possible. t.networking Relates to networking within an app
Projects
None yet
Development

No branches or pull requests

4 participants