fix: improve Redis response parsing and error handling

- Add error handling for non-array and error responses
- Introduce `strget()` for safer string conversion from RValue
- Update AGE client to use `strget()` for key retrieval
- Change AGE verify methods to expect a string response
- Handle multiple response types when listing AGE keys
This commit is contained in:
Mahmoud-Emad
2025-09-14 18:15:23 +03:00
parent 0ef28b6cfe
commit 92c8a3b955
3 changed files with 52 additions and 16 deletions

View File

@@ -83,5 +83,16 @@ pub fn (mut r Redis) send_expect_list(items []string) ![]resp.RValue {
}
r.write_cmds(items)!
res := r.get_response()!
// Check if we got an error response
if res is resp.RError {
return error('Redis error: ${res.value}')
}
// Check if we got an array response
if res !is resp.RArray {
return error('Expected array response but got ${res.type_name()}. Response: ${resp.get_redis_value(res)}')
}
return resp.get_redis_array(res)
}