File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
1414 "iter"
1515 "maps"
1616 "net/url"
17+ "os"
1718 "path/filepath"
1819 "reflect"
1920 "slices"
@@ -337,10 +338,13 @@ func (s *Server) AddResource(r *Resource, h ResourceHandler) {
337338 func () bool {
338339 u , err := url .Parse (r .URI )
339340 if err != nil {
340- panic (err ) // url.Parse includes the URI in the error
341- }
342- if ! u .IsAbs () {
343- panic (fmt .Errorf ("URI %s needs a scheme" , r .URI ))
341+ //panic(err) // url.Parse includes the URI in the error
342+ fmt .Fprintf (os .Stderr , "invalid resource URI %q: %v\n " , r .URI , err )
343+ } else {
344+ if ! u .IsAbs () {
345+ //panic(fmt.Errorf("URI %s needs a scheme", r.URI))
346+ fmt .Fprintf (os .Stderr , "invalid resource URI %q: %v\n " , r .URI , err )
347+ }
344348 }
345349 s .resources .add (& serverResource {r , h })
346350 return true
You can’t perform that action at this time.
0 commit comments