Skip to content

Commit

Permalink
return error instead of panic
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed Feb 3, 2023
1 parent b9429e7 commit a3d87b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/client/apiutil/dynamicrestmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package apiutil

import (
"fmt"
"net/http"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -78,7 +79,7 @@ func WithCustomMapper(newMapper func() (meta.RESTMapper, error)) DynamicRESTMapp
// configure the RESTMapper.
func NewDynamicRESTMapper(cfg *rest.Config, httpClient *http.Client, opts ...DynamicRESTMapperOption) (meta.RESTMapper, error) {
if httpClient == nil {
panic("httpClient must not be nil")
return nil, fmt.Errorf("httpClient must not be nil, consider using rest.HTTPClientFor(c) to create a client")
}

client, err := discovery.NewDiscoveryClientForConfigAndClient(cfg, httpClient)
Expand Down

0 comments on commit a3d87b5

Please sign in to comment.