mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
gstreamer: Add error/warning/info message constructors from a pre-existing glib::Error
This commit is contained in:
parent
40dcdcbf5c
commit
7420a72831
1 changed files with 44 additions and 0 deletions
|
@ -313,6 +313,20 @@ impl Error {
|
|||
ErrorBuilder::new(glib::Error::new(error, message))
|
||||
}
|
||||
|
||||
pub fn builder_from_error<'a>(error: glib::Error) -> ErrorBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
use glib::error::ErrorDomain;
|
||||
assert!([
|
||||
crate::CoreError::domain(),
|
||||
crate::ResourceError::domain(),
|
||||
crate::StreamError::domain(),
|
||||
crate::LibraryError::domain(),
|
||||
]
|
||||
.contains(&error.domain()));
|
||||
ErrorBuilder::new(error)
|
||||
}
|
||||
|
||||
#[doc(alias = "get_error")]
|
||||
#[doc(alias = "gst_message_parse_error")]
|
||||
pub fn error(&self) -> glib::Error {
|
||||
|
@ -368,6 +382,21 @@ impl Warning {
|
|||
WarningBuilder::new(glib::Error::new(error, message))
|
||||
}
|
||||
|
||||
pub fn builder_from_error<'a>(error: glib::Error) -> WarningBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
use glib::error::ErrorDomain;
|
||||
|
||||
assert!([
|
||||
crate::CoreError::domain(),
|
||||
crate::ResourceError::domain(),
|
||||
crate::StreamError::domain(),
|
||||
crate::LibraryError::domain(),
|
||||
]
|
||||
.contains(&error.domain()));
|
||||
WarningBuilder::new(error)
|
||||
}
|
||||
|
||||
#[doc(alias = "get_error")]
|
||||
#[doc(alias = "gst_message_parse_warning")]
|
||||
pub fn error(&self) -> glib::Error {
|
||||
|
@ -423,6 +452,21 @@ impl Info {
|
|||
InfoBuilder::new(glib::Error::new(error, message))
|
||||
}
|
||||
|
||||
pub fn builder_from_error<'a>(error: glib::Error) -> InfoBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
use glib::error::ErrorDomain;
|
||||
|
||||
assert!([
|
||||
crate::CoreError::domain(),
|
||||
crate::ResourceError::domain(),
|
||||
crate::StreamError::domain(),
|
||||
crate::LibraryError::domain(),
|
||||
]
|
||||
.contains(&error.domain()));
|
||||
InfoBuilder::new(error)
|
||||
}
|
||||
|
||||
#[doc(alias = "get_error")]
|
||||
#[doc(alias = "gst_message_parse_info")]
|
||||
pub fn error(&self) -> glib::Error {
|
||||
|
|
Loading…
Reference in a new issue