Zitadel API is known to clash logical errors and transport errors, so for example, to return Ok(None) for when a user metadata not found in "get user metadata", we do this in v1 client:
|
// `QUERY-Rgh32` is the grpc message returned by Zitadel when no metadata was |
|
// found for the given key |
|
if let Err(status) = &response { |
|
if status.code() == tonic::Code::NotFound && status.message().contains("QUERY-Rgh32") { |
|
tracing::debug!("No user '{user_id}' metadata found for key '{key}'. Organization ID: {organization_id:?}"); |
|
return Ok(None); |
|
} |
|
} |
None of the v2 client methods implement this handling logic. We need to go through the methods and implement similar type of logic where it can be useful.
Zitadel API is known to clash logical errors and transport errors, so for example, to return
Ok(None)for when a user metadata not found in "get user metadata", we do this in v1 client:zitadel-rust-client/src/v1/mod.rs
Lines 555 to 562 in 079efd5
None of the v2 client methods implement this handling logic. We need to go through the methods and implement similar type of logic where it can be useful.
{ "code": 5, "message": "Metadata not found (QUERY-Rgh32)", "details": [ { "@type": "type.googleapis.com/zitadel.v1.ErrorDetail", "id": "QUERY-Rgh32", // ideally we want to check this field instead of .message "message": "Metadata not found" } ] }