Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09d661e

Browse files
committed
Fix SSE errors not logging correctly
1 parent3e5ca51 commit09d661e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

‎src/api-helper.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import{isApiError,isApiErrorResponse}from"coder/site/src/api/errors"
12
import{Workspace,WorkspaceAgent}from"coder/site/src/api/typesGenerated"
23
import{z}from"zod"
34

45
exportfunctionerrToStr(error:unknown,def:string){
56
if(errorinstanceofError&&error.message){
67
returnerror.message
7-
}
8-
if(typeoferror==="string"&&error.trim().length>0){
8+
}elseif(isApiError(error)){
9+
returnerror.response.data.message
10+
}elseif(isApiErrorResponse(error)){
11+
returnerror.message
12+
}elseif(typeoferror==="string"&&error.trim().length>0){
913
returnerror
1014
}
1115
returndef

‎src/workspaceMonitor.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export class WorkspaceMonitor implements vscode.Disposable {
6363
}
6464
})
6565

66-
eventSource.addEventListener("error",(error)=>{
67-
this.notifyError(error)
66+
eventSource.addEventListener("error",(event)=>{
67+
this.notifyError(event.data)
6868
})
6969

7070
// Store so we can close in dispose().
@@ -182,9 +182,9 @@ export class WorkspaceMonitor implements vscode.Disposable {
182182
}
183183

184184
privatenotifyError(error:unknown){
185-
constmessage=errToStr(error,"No error message was provided")
185+
// For now, we are not bothering the user about this.
186+
constmessage=errToStr(error,"Got empty error")
186187
this.storage.writeToCoderOutputChannel(message)
187-
vscode.window.showErrorMessage(`Failed to monitor workspace:${message}`)
188188
}
189189

190190
privateupdateContext(workspace:Workspace){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp