feat(clients): integrate plan 18: API catalog for 83 Google services, key table, detail error envelope, docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,16 @@ ApiError error_from_response(const std::string& vendor,
|
||||
message = err->as_string();
|
||||
} else if (doc.is_object()) {
|
||||
std::string m = text_of(doc.find("message"));
|
||||
// FastAPI-style envelope: {"detail":"text"} or {"detail":[{"msg":"text"}]}.
|
||||
if (m.empty()) {
|
||||
const Json* d = doc.find("detail");
|
||||
if (d && d->is_array() && !d->as_array().empty()) {
|
||||
const Json& first = d->as_array().front();
|
||||
m = first.is_object() ? text_of(first.find("msg")) : text_of(&first);
|
||||
} else {
|
||||
m = text_of(d);
|
||||
}
|
||||
}
|
||||
if (!m.empty()) message = m;
|
||||
std::string t = text_of(doc.find("type"));
|
||||
if (t.empty()) t = text_of(doc.find("code"));
|
||||
|
||||
Reference in New Issue
Block a user