improve error messages
This commit is contained in:
		
							parent
							
								
									0ab248c478
								
							
						
					
					
						commit
						253568ef29
					
				@ -494,7 +494,7 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
 | 
			
		||||
                        commonStore.setTracks(tracks);
 | 
			
		||||
                        refreshTracksTotalTime();
 | 
			
		||||
                      } else {
 | 
			
		||||
                        toast(r.statusText + '\n' + (await r.text()), {
 | 
			
		||||
                        toast('Failed to fetch - ' + r.status + ' - ' + r.statusText + ' - ' + (await r.text()), {
 | 
			
		||||
                          type: 'error'
 | 
			
		||||
                        });
 | 
			
		||||
                      }
 | 
			
		||||
 | 
			
		||||
@ -608,7 +608,12 @@ const ChatPanel: FC = observer(() => {
 | 
			
		||||
        },
 | 
			
		||||
        async onopen(response) {
 | 
			
		||||
          if (response.status !== 200) {
 | 
			
		||||
            commonStore.conversation[answerId!].content += '\n[ERROR]\n```\n' + response.statusText + '\n' + (await response.text()) + '\n```';
 | 
			
		||||
            let errText = await response.text();
 | 
			
		||||
            try {
 | 
			
		||||
              errText = JSON.stringify(JSON.parse(errText), null, 2);
 | 
			
		||||
            } catch (e) {
 | 
			
		||||
            }
 | 
			
		||||
            commonStore.conversation[answerId!].content += '\n[ERROR]\n```\n' + response.status + ' - ' + response.statusText + '\n' + errText + '\n```';
 | 
			
		||||
            commonStore.setConversation(commonStore.conversation);
 | 
			
		||||
            commonStore.setConversationOrder([...commonStore.conversationOrder]);
 | 
			
		||||
            setTimeout(scrollToBottom);
 | 
			
		||||
@ -746,7 +751,7 @@ const ChatPanel: FC = observer(() => {
 | 
			
		||||
                                  autoClose: 1000
 | 
			
		||||
                                });
 | 
			
		||||
                            } else {
 | 
			
		||||
                              toast(r.statusText + '\n' + (await r.text()), {
 | 
			
		||||
                              toast('Failed to fetch - ' + r.status + ' - ' + r.statusText + ' - ' + (await r.text()), {
 | 
			
		||||
                                type: 'error'
 | 
			
		||||
                              });
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
@ -132,7 +132,7 @@ const CompletionPanel: FC = observer(() => {
 | 
			
		||||
        },
 | 
			
		||||
        async onopen(response) {
 | 
			
		||||
          if (response.status !== 200) {
 | 
			
		||||
            toast(response.statusText + '\n' + (await response.text()), {
 | 
			
		||||
            toast(response.status + ' - ' + response.statusText + ' - ' + (await response.text()), {
 | 
			
		||||
              type: 'error'
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
@ -235,7 +235,7 @@ const CompositionPanel: FC = observer(() => {
 | 
			
		||||
        },
 | 
			
		||||
        async onopen(response) {
 | 
			
		||||
          if (response.status !== 200) {
 | 
			
		||||
            toast(response.statusText + '\n' + (await response.text()), {
 | 
			
		||||
            toast(response.status + ' - ' + response.statusText + ' - ' + (await response.text()), {
 | 
			
		||||
              type: 'error'
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user