mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-31 03:26:27 +08:00
add another error helper for elements
This commit is contained in:
@@ -217,6 +217,14 @@ func (e *Element) WarningMessage(domain Domain, text string) {
|
|||||||
e.MessageFull(MessageWarning, domain, ErrorCode(0), "", text, path.Base(file), runtime.FuncForPC(function).Name(), line)
|
e.MessageFull(MessageWarning, domain, ErrorCode(0), "", text, path.Base(file), runtime.FuncForPC(function).Name(), line)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error is a convenience wrapper around ErrorMessage to simply post the provided go error on the bus.
|
||||||
|
// The domain is assumed to be DomainLibrary and the code is assumed to be LibraryErrorFailed.
|
||||||
|
func (e *Element) Error(msg string, err error) {
|
||||||
|
function, file, line, _ := runtime.Caller(1)
|
||||||
|
debugMsg := fmt.Sprintf("%s: %s", msg, err.Error())
|
||||||
|
e.MessageFull(MessageError, DomainLibrary, LibraryErrorFailed, err.Error(), debugMsg, path.Base(file), runtime.FuncForPC(function).Name(), line)
|
||||||
|
}
|
||||||
|
|
||||||
// ErrorMessage is a convenience wrapper for posting an error message from inside an element. Only to be used from
|
// ErrorMessage is a convenience wrapper for posting an error message from inside an element. Only to be used from
|
||||||
// plugins.
|
// plugins.
|
||||||
func (e *Element) ErrorMessage(domain Domain, code ErrorCode, text, debug string) {
|
func (e *Element) ErrorMessage(domain Domain, code ErrorCode, text, debug string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user