Code Review
/
src
/
xds
/
xds-cli.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Improved reported error on invalid XDS_AGENT_URL
[src/xds/xds-cli.git]
/
main.go
diff --git
a/main.go
b/main.go
index
ad237af
..
bf03375
100644
(file)
--- a/
main.go
+++ b/
main.go
@@
-328,15
+328,22
@@
func XdsConnInit(ctx *cli.Context) error {
CsrfDisable: true,
LogOut: Log.Out,
LogPrefix: "XDSAGENT: ",
CsrfDisable: true,
LogOut: Log.Out,
LogPrefix: "XDSAGENT: ",
- LogLevel: common.HTTPLogLevel
Warnin
g,
+ LogLevel: common.HTTPLogLevel
Debu
g,
}
HTTPCli, err = common.HTTPNewClient(agentURL, conf)
if err != nil {
errmsg := err.Error()
}
HTTPCli, err = common.HTTPNewClient(agentURL, conf)
if err != nil {
errmsg := err.Error()
- if m, err := regexp.MatchString("Get http.?://", errmsg); m && err == nil {
+ m, err := regexp.MatchString("Get http.?://", errmsg)
+ if (m && err == nil) || strings.Contains(errmsg, "Failed to get device ID") {
i := strings.LastIndex(errmsg, ":")
i := strings.LastIndex(errmsg, ":")
- errmsg = "Cannot connection to " + agentURL + errmsg[i:]
+ newErr := "Cannot connection to " + agentURL
+ if i > 0 {
+ newErr += " (" + strings.TrimSpace(errmsg[i+1:]) + ")"
+ } else {
+ newErr += " (" + strings.TrimSpace(errmsg) + ")"
+ }
+ errmsg = newErr
}
return cli.NewExitError(errmsg, 1)
}
}
return cli.NewExitError(errmsg, 1)
}