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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user