File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
tools/server/public_simplechat Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -742,6 +742,13 @@ class SimpleChat {
742742 * @param {HTMLDivElement } elDivChat - used to show chat response as it is being generated/recieved in streaming mode
743743 */
744744 async handle_chat_hs ( baseURL , apiEP , elDivChat ) {
745+ class ChatHSError extends Error {
746+ constructor ( /** @type {string } */ message ) {
747+ super ( message ) ;
748+ this . name = 'ChatHSError'
749+ }
750+ }
751+
745752 let theUrl = ApiEP . Url ( baseURL , apiEP ) ;
746753 let theBody = this . request_jsonstr ( apiEP ) ;
747754 console . debug ( `DBUG:SimpleChat:${ this . chatId } :HandleChatHS:${ theUrl } :ReqBody:${ theBody } ` ) ;
@@ -754,7 +761,7 @@ class SimpleChat {
754761 } ) ;
755762
756763 if ( resp . status >= 300 ) {
757-
764+ throw new ChatHSError ( `HandleChatHS:GotResponse:NotOk: ${ resp . status } : ${ resp . statusText } ` ) ;
758765 }
759766
760767 return this . handle_response ( resp , apiEP , elDivChat ) ;
You can’t perform that action at this time.
0 commit comments