Skip to content

Commit 2731296

Browse files
committed
Imrpoved error message handling
1 parent 5cf9c0e commit 2731296

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

+llms/+stream/responseStreamer.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343
try
4444
json = jsondecode(str{i});
4545
catch ME
46-
error("API returned il-formed json: " + str{i})
46+
errID = 'llms:stream:responseStreamer:InvalidInput';
47+
msg = "Input does not have the expected json format. " + str{i};
48+
causeException = MException(errID,msg);
49+
ME = addCause(ME,causeException);
50+
rethrow(ME)
4751
end
4852
if ischar(json.choices.finish_reason) && ismember(json.choices.finish_reason,["stop","tool_calls"])
4953
stop = true;

0 commit comments

Comments
 (0)