Skip to content

Commit 25f785e

Browse files
committed
Bugfix: Add error handling for unreachable cloud in snippet downloading
1 parent 003c68a commit 25f785e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Source/Chatbook/Common.wl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ catchMine // endDefinition;
631631
(* ::Subsection::Closed:: *)
632632
(*throwTop*)
633633
throwTop // beginDefinition;
634-
throwTop[ expr_ ] /; $catching := Throw[ Unevaluated @ expr, $catchTopTag ];
634+
throwTop[ expr_ ] := If[ TrueQ @ $catching, Throw[ Unevaluated @ expr, $catchTopTag ], expr ];
635635
throwTop // endDefinition;
636636

637637
(* ::**************************************************************************************************************:: *)

Source/Chatbook/PromptGenerators/RelatedDocumentation.wl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,9 @@ processDocumentationSnippetResult[ base_String, as_Association ] :=
10181018
processDocumentationSnippetResult[ base_String, as_, bytes_ByteArray, 200 ] :=
10191019
processDocumentationSnippetResult[ base, as, Quiet @ Developer`ReadWXFByteArray @ bytes ];
10201020

1021-
processDocumentationSnippetResult[ base_String, as_Association, bytes_, code: Except[ 200, _Integer ] ] :=
1021+
(* A 401/403 means we're missing a file in the snippet deployment or it has the wrong permissions,
1022+
so it should trigger an internal failure, otherwise just issue a generic cloud download failure. *)
1023+
processDocumentationSnippetResult[ base_String, as_Association, bytes_, code: Except[ 401|403 ] ] :=
10221024
throwFailureToChatOutput @ Failure[
10231025
"CloudDownloadError",
10241026
<|

Source/Chatbook/SendChat.wl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2594,7 +2594,7 @@ throwFailureToChatOutput[ task_, cell_CellObject, failure_ ] := (
25942594
]
25952595
);
25962596

2597-
throwFailureToChatOutput[ task_, None, failure_Failure ] := (
2597+
throwFailureToChatOutput[ task_, _, failure_Failure ] := (
25982598
Quiet @ TaskRemove @ task;
25992599
throwTop @ failure
26002600
);

0 commit comments

Comments
 (0)