-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Replace panic calls with proper error handling #7956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,16 +39,16 @@ func TryLoadConfigFile(v *viper.Viper) error { | |
| } | ||
|
|
||
| // ParseJaegerTags parses the Jaeger tags string into a map. | ||
| func ParseJaegerTags(jaegerTags string) map[string]string { | ||
| func ParseJaegerTags(jaegerTags string) (map[string]string, error) { | ||
| if jaegerTags == "" { | ||
| return nil | ||
| return nil, nil | ||
| } | ||
|
Comment on lines
+42
to
45
|
||
| tagPairs := strings.Split(string(jaegerTags), ",") | ||
| tags := make(map[string]string) | ||
| for _, p := range tagPairs { | ||
| kv := strings.SplitN(p, "=", 2) | ||
| if len(kv) != 2 { | ||
| panic(fmt.Sprintf("invalid Jaeger tag pair %q, expected key=value", p)) | ||
| return nil, fmt.Errorf("invalid Jaeger tag pair %q, expected key=value", p) | ||
| } | ||
| k, v := strings.TrimSpace(kv[0]), strings.TrimSpace(kv[1]) | ||
|
|
||
|
|
@@ -77,7 +77,7 @@ func ParseJaegerTags(jaegerTags string) map[string]string { | |
| tags[k] = v | ||
| } | ||
|
|
||
| return tags | ||
| return tags, nil | ||
| } | ||
|
|
||
| // SharedFlags holds flags configuration | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.