-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
I'm not a fun of using panic inside a client library, this could lead to unexpected crashes of code using the library.
Lines 74 to 79 in e010bf4
| if err != nil { | |
| msg := fmt.Sprintf( | |
| "error formatting URL \"%s\": %s", | |
| pathFmt, err) | |
| panic(msg) | |
| } |
What about creating a new method like this?
func NewURL(pathFmt string, a ...interface{}) (*url.URLm, error) {
path := fmt.Sprintf(pathFmt, a...)
url, err := url.Parse(path)
if err != nil {
return nil, fmt.Errorf(
"error formatting URL \"%s\": %s",
pathFmt, err)
}
return baseURL.ResolveReference(url), nil
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels