Skip to content

Strange enum Error #166

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

Open
MariaGolubev opened this issue Mar 15, 2022 · 1 comment
Open

Strange enum Error #166

MariaGolubev opened this issue Mar 15, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@MariaGolubev
Copy link

Error contains new(String) - This is bad code!!!!!

i get such an error:

>> new("io error: Conn is closed")

i expected to get: Error::ErrConnectionClosed

I get this error when I try to write a packet to the track:

while let Some(sample) = appsink_stream.next().await {
            if let Some(buffer) = sample.buffer() {
                if let Ok(map) = buffer.map_readable() {
                    let slice = map.as_slice();

                    if let Err(err) = video_track_clone.write(slice).await {
                        match err {
                            webrtc::Error::ErrConnectionClosed => continue,
                            webrtc::Error::ErrClosedPipe => break,
                            err => {
                                tracing::error!("video_track write err: {err}");
                                break;
                            }
                        }
                    }
                } else {
                    break;
                }
            } else {
                break;
            }
        }

I am using Arc<TrackLocalStaticRTP> in several RTCPeerConnection
The error appears when closing several RTCPeerConnection

@k0nserv
Copy link
Member

k0nserv commented Apr 14, 2022

I suspect it was ported when @algesten moved the error type from anyhow to thiserror, anyhow is more stringly typed.

I think the way forward here is to start converting the errors that use the new variant to bespoke variants.

PRs that do this are welcome I expect

@k0nserv k0nserv added enhancement New feature or request good first issue Good for newcomers labels May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants