diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-30 01:39:39 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-30 01:39:39 +0900 |
| commit | 3d4c7cdd9e82d1cc48e2564f4e5a569424a1819b (patch) | |
| tree | 9d555cd3be52910e5dc05a352e60e3d631f8f31d /internal/pipewire/core.go | |
| parent | 4fd6d6c037b30b02aff861542721b0cc40f083fe (diff) | |
internal/pipewire: implement Core::Error
Sample was captured from pw-cli.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core.go')
| -rw-r--r-- | internal/pipewire/core.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index 99e4137e..a15d0803 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -167,6 +167,42 @@ func (c *CorePing) MarshalBinary() ([]byte, error) { return Marshal(c) } // UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. func (c *CorePing) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } +// The CoreError can be emitted by both the client and the server. +// +// When emitted by the server, the error event is sent out when a fatal +// (non-recoverable) error has occurred. The id argument is the proxy +// object where the error occurred, most often in response to a request +// to that object. The message is a brief description of the error, for +// (debugging) convenience. +// +// When emitted by the client, it indicates an error occurred in an +// object on the client. +type CoreError struct { + // The id of the resource (proxy if emitted by the client) that is in error. + ID Int `json:"id"` + // A seq number from the failing request (if any). + Sequence Int `json:"seq"` + // A negative errno style error code. + Result Int `json:"res"` + // An error message. + Message String `json:"message"` +} + +// Size satisfies [KnownSize] with a value computed at runtime. +func (c *CoreError) Size() Word { + return SizePrefix + + Size(SizeInt) + + Size(SizeInt) + + Size(SizeInt) + + SizeString[Word](c.Message) +} + +// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal]. +func (c *CoreError) MarshalBinary() ([]byte, error) { return Marshal(c) } + +// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. +func (c *CoreError) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } + // The CoreBoundProps event is emitted when a local object ID is bound to a global ID. // It is emitted before the global becomes visible in the registry. type CoreBoundProps struct { |
