fix error handler

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-01-23 09:23:38 +03:00
parent dece47ae0e
commit 7c15ee784a
2 changed files with 8 additions and 2 deletions

View File

@@ -602,11 +602,15 @@ func (h *httpServer) Name() string {
func NewServer(opts ...server.Option) *httpServer {
options := server.NewOptions(opts...)
eh := DefaultErrorHandler
if v, ok := options.Context.Value(errorHandlerKey{}).(errorHandler); ok && v != nil {
eh = v
}
return &httpServer{
opts: options,
exit: make(chan chan error),
subscribers: make(map[*httpSubscriber][]broker.Subscriber),
errorHandler: DefaultErrorHandler,
errorHandler: eh,
pathHandlers: rhttp.NewTrie(),
}
}