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

Commita910e93

Browse files
authored
chore: improve error message around gitaskpass failures (#9407)
1 parent2399063 commita910e93

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

‎cli/gitaskpass.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ func (r *RootCmd) gitAskpass() *clibase.Cmd {
4444
iferrors.As(err,&apiError)&&apiError.StatusCode()==http.StatusNotFound {
4545
// This prevents the "Run 'coder --help' for usage"
4646
// message from occurring.
47-
cliui.Errorf(inv.Stderr,"%s\n",apiError.Message)
47+
lines:= []string{apiError.Message}
48+
ifapiError.Detail!="" {
49+
lines=append(lines,apiError.Detail)
50+
}
51+
cliui.Warn(inv.Stderr,"Coder was unable to handle this git request. The default git behavior will be used instead.",
52+
lines...,
53+
)
4854
returncliui.Canceled
4955
}
5056
returnxerrors.Errorf("get git token: %w",err)

‎coderd/workspaceagents.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1996,8 +1996,17 @@ func (api *API) workspaceAgentsGitAuth(rw http.ResponseWriter, r *http.Request)
19961996
gitAuthConfig=gitAuth
19971997
}
19981998
ifgitAuthConfig==nil {
1999+
detail:="No git providers are configured."
2000+
iflen(api.GitAuthConfigs)>0 {
2001+
regexURLs:=make([]string,0,len(api.GitAuthConfigs))
2002+
for_,gitAuth:=rangeapi.GitAuthConfigs {
2003+
regexURLs=append(regexURLs,fmt.Sprintf("%s=%q",gitAuth.ID,gitAuth.Regex.String()))
2004+
}
2005+
detail=fmt.Sprintf("The configured git provider have regex filters that do not match the git url. Provider url regexs: %s",strings.Join(regexURLs,","))
2006+
}
19992007
httpapi.Write(ctx,rw,http.StatusNotFound, codersdk.Response{
2000-
Message:fmt.Sprintf("No git provider found for URL %q",gitURL),
2008+
Message:fmt.Sprintf("No matching git provider found in Coder for the url %q.",gitURL),
2009+
Detail:detail,
20012010
})
20022011
return
20032012
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp