InitHandler sets the app handler's search handler, if the app handler was configured to have one with HasSearch.
(hl blobserver.FindHandlerByTyper)
| 437 | // InitHandler sets the app handler's search handler, if the app handler was configured |
| 438 | // to have one with HasSearch. |
| 439 | func (a *Handler) InitHandler(hl blobserver.FindHandlerByTyper) error { |
| 440 | apName := a.ProgramName() |
| 441 | searchPrefix, _, err := hl.FindHandlerByType("search") |
| 442 | if err != nil { |
| 443 | return fmt.Errorf("No search handler configured, which is necessary for the %v app handler", apName) |
| 444 | } |
| 445 | var sh *search.Handler |
| 446 | _, hi := hl.AllHandlers() |
| 447 | h, ok := hi[searchPrefix] |
| 448 | if !ok { |
| 449 | return fmt.Errorf("failed to find the \"search\" handler for %v", apName) |
| 450 | } |
| 451 | sh = h.(*search.Handler) |
| 452 | a.sh = sh |
| 453 | return nil |
| 454 | } |
| 455 | |
| 456 | func (a *Handler) Start() error { |
| 457 | name := a.name |
nothing calls this directly
no test coverage detected