fix(qconnect): fix queue error decode and add context_uuid to queue commands

ErrorMessage.code was defined as int32 but server sends string codes
(e.g. 'ERROR_QUEUE_INSERT_TRACKS'). Changed to string type and added
logging for queue error responses.

Added context_uuid (random UUID v4) to queue insert and add commands -
the server likely requires this to associate tracks with a context.
This commit is contained in:
vicrodh committed 2026-02-22 02:45:04 -06:00
1 parent 92b82a62dd
commit 65f0f25203
4 files changed
+12 -4

No files matched your search

+1
View File
@@ -10,5 +10,6 @@ qconnect-core = { path = "../qconnect-core" }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
log = { workspace = true }
prost = "0.13"
uuid = { version = "1", features = ["v4"] }
+5 -2
View File
@@ -488,8 +488,7 @@ fn map_queue_error(payload: QueueErrorMessage) -> Result<QueueServerEvent, Proto
let error_code = payload
.error
.as_ref()
.and_then(|err| err.code)
.map(|code| code.to_string())
.and_then(|err| err.code.clone())
.unwrap_or_else(|| "remote_error".to_string());
let error_message = payload
.error
@@ -497,6 +496,10 @@ fn map_queue_error(payload: QueueErrorMessage) -> Result<QueueServerEvent, Proto
.and_then(|err| err.message.clone())
.unwrap_or_else(|| "queue_error_message".to_string());
log::warn!(
"[QConnect/Decode] Queue error from server: code={error_code} message={error_message}"
);
Ok(QueueServerEvent {
event_type: QueueEventType::SrvrCtrlQueueErrorMessage,
action_uuid: uuid_bytes_to_string_opt(payload.action_uuid, "queue_error.action_uuid")?,
@@ -74,8 +74,10 @@ pub struct QueueVersionRef {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorMessage {
#[prost(int32, optional, tag = "1")]
pub code: Option<i32>,
/// Server sends error codes as strings (e.g. "ERROR_QUEUE_INSERT_TRACKS"),
/// not integers. Wire type = LengthDelimited (string).
#[prost(string, optional, tag = "1")]
pub code: Option<String>,
#[prost(string, optional, tag = "2")]
pub message: Option<String>,
}