SL-18629 Better item fetch error handling

meow-7.2.2
Andrey Kleshchev 2023-08-09 12:52:17 +03:00
parent ce0300e966
commit 8e1c5fee2b
1 changed files with 8 additions and 3 deletions

View File

@ -986,6 +986,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
case FETCHITEM:
if (result.has("item_id"))
{
// Error message might contain an item_id!!!
id = result["item_id"];
}
if (result.has("linked_id"))
@ -1167,11 +1168,15 @@ void AISUpdate::parseMeta(const LLSD& update)
void AISUpdate::parseContent(const LLSD& update)
{
if (update.has("linked_id"))
// Errors from a fetch request might contain id without
// full item or folder.
// Todo: Depending on error we might want to do something,
// like removing a 404 item or refetching parent folder
if (update.has("linked_id") && update.has("parent_id"))
{
parseLink(update, mFetchDepth);
}
else if (update.has("item_id"))
else if (update.has("item_id") && update.has("parent_id"))
{
parseItem(update);
}
@ -1185,7 +1190,7 @@ void AISUpdate::parseContent(const LLSD& update)
parseEmbedded(update["_embedded"], mFetchDepth - 1);
}
}
else if (update.has("category_id"))
else if (update.has("category_id") && update.has("parent_id"))
{
parseCategory(update, mFetchDepth);
}