internal/pipewire: handle Core::Error
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m37s
Test / Sandbox (race detector) (push) Successful in 4m40s
Test / Hakurei (push) Successful in 4m59s
Test / Hpkg (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m24s
Test / Flake checks (push) Successful in 1m28s

This event is not encountered in the pw-container sample, but already has existing sample from an excerpt.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-12-02 06:16:18 +09:00
parent af741f20a0
commit e7a665e043
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -206,6 +206,14 @@ type CoreError struct {
Message String `json:"message"` Message String `json:"message"`
} }
func (c *CoreError) Error() string {
return "received Core::Error on" +
" id " + strconv.Itoa(int(c.ID)) +
" seq " + strconv.Itoa(int(c.Sequence)) +
" res " + strconv.Itoa(int(c.Result)) +
": " + c.Message
}
// Size satisfies [KnownSize] with a value computed at runtime. // Size satisfies [KnownSize] with a value computed at runtime.
func (c *CoreError) Size() Word { func (c *CoreError) Size() Word {
return SizePrefix + return SizePrefix +
@ -543,6 +551,13 @@ func (core *Core) consume(opcode byte, files []int, unmarshal func(v any) error)
// anything, and this behaviour is never mentioned in documentation // anything, and this behaviour is never mentioned in documentation
return nil return nil
case PW_CORE_EVENT_ERROR:
var coreError CoreError
if err := unmarshal(&coreError); err != nil {
return err
}
return &coreError
case PW_CORE_EVENT_BOUND_PROPS: case PW_CORE_EVENT_BOUND_PROPS:
var boundProps CoreBoundProps var boundProps CoreBoundProps
if err := unmarshal(&boundProps); err != nil { if err := unmarshal(&boundProps); err != nil {