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

Error: Add a status_code method on the Error struct to query the RTSP status code, if any #82

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

nemosupremo
Copy link
Contributor

This is useful to query the Error status code, for example, if the request was denied because the request was unauthorized due to the username/password being wrong.

src/error.rs Outdated
@@ -19,6 +19,16 @@ use thiserror::Error;
#[derive(Clone)]
pub struct Error(pub(crate) Arc<ErrorInt>);

impl Error {
/// Returns the status code, if the error was generated from a response.
pub fn status_code(&self) -> Option<rtsp_types::StatusCode> {
Copy link
Owner

Choose a reason for hiding this comment

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

Could you convert this to an u16? rtsp_types isn't part of the public interface now, and I've bumped this dep's version before without worrying about semver. I've actually been tempted to stop depending on it entirely as part of an IO overhaul.

@scottlamb scottlamb merged commit 77265a4 into scottlamb:main Jan 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants