mirror of
https://github.com/go-gst/go-gst.git
synced 2025-11-03 02:23:41 +08:00
finish GstMessage constructors
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package gst
|
||||
|
||||
// GError is a Go wrapper for a C GError. It implements the error interface
|
||||
// GError is a Go wrapper for a C GError in the context of GStreamer. It implements the error interface
|
||||
// and provides additional functions for retrieving debug strings and details.
|
||||
type GError struct {
|
||||
errMsg, debugStr string
|
||||
structure *Structure
|
||||
|
||||
// used for message constructors
|
||||
code int
|
||||
}
|
||||
|
||||
// Message is an alias to `Error()`. It's for clarity when this object
|
||||
@@ -19,3 +22,12 @@ func (e *GError) DebugString() string { return e.debugStr }
|
||||
|
||||
// Structure returns the structure of the error message which may contain additional metadata.
|
||||
func (e *GError) Structure() *Structure { return e.structure }
|
||||
|
||||
// NewGError wraps the given error inside a GError (to be used with message constructors). The code
|
||||
// is optional and allows for adding additional "types" to the error.
|
||||
func NewGError(code int, err error) *GError {
|
||||
return &GError{
|
||||
errMsg: err.Error(),
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user