Skip to content

Commit a7dcd9f

Browse files
committed
Bugfix: Add error handling for unreachable cloud when checking vector DB downloads
1 parent b2b4077 commit a7dcd9f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Source/Chatbook/PromptGenerators/VectorDatabases.wl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,22 @@ cleanupLegacyVectorDBFiles // endDefinition;
429429
(* ::Subsubsection::Closed:: *)
430430
(*getDownloadSize*)
431431
getDownloadSize // beginDefinition;
432+
432433
getDownloadSize[ url_String ] := getDownloadSize @ CloudObject @ url;
433-
getDownloadSize[ obj: $$cloudObject ] := FileByteCount @ obj;
434+
getDownloadSize[ obj: $$cloudObject ] := getDownloadSize[ obj, FileByteCount @ obj ];
435+
getDownloadSize[ obj_, size_Integer ] := size;
436+
437+
getDownloadSize[ obj_, $Failed ] := throwFailureToChatOutput @ Failure[
438+
"CloudDownloadError",
439+
<|
440+
"MessageTemplate" :> Chatbook::CloudDownloadError,
441+
"MessageParameters" -> { },
442+
"CloudObject" -> obj,
443+
"Evaluation" -> HoldForm @ FileByteCount @ obj,
444+
"Results" -> $Failed
445+
|>
446+
];
447+
434448
getDownloadSize // endDefinition;
435449

436450
(* ::**************************************************************************************************************:: *)

0 commit comments

Comments
 (0)