func (s *Server) SetErrorHandler(handler ErrorHandler) {
	s.errorHandler = handler
}
Registers a handler for incoming error messages.
package ocppj
import (
	"fmt"
	"github.com/lorenzodonini/ocpp-go/ocpp"
	"github.com/lorenzodonini/ocpp-go/ws"
)
type Server struct {
	Endpoint
	server                    ws.WsServer
	newClientHandler          ClientHandler
	disconnectedClientHandler ClientHandler
	requestHandler            RequestHandler
	responseHandler           ResponseHandler
	errorHandler              ErrorHandler
	dispatcher                ServerDispatcher
	RequestState              ServerState
}
type ClientHandler func(client ws.Channel)
type RequestHandler func(client ws.Channel, request ocpp.Request, requestId string, action string)
type ResponseHandler func(client ws.Channel, response ocpp.Response, requestId string)
type ErrorHandler func(client ws.Channel, err *ocpp.Error, details interface{})
func NewServer(wsServer ws.WsServer, dispatcher ServerDispatcher, stateHandler ServerState, profiles ...*ocpp.Profile) *Server {
	if dispatcher == nil {
		dispatcher = NewDefaultServerDispatcher(NewFIFOQueueMap(0))
	}
	if stateHandler == nil {
		d, ok := dispatcher.(*DefaultServerDispatcher)
		if !ok {
			stateHandler = NewServerState(nil)
		} else {
			stateHandler = d.pendingRequestState
		}
	}
	if wsServer == nil {
		wsServer = ws.NewServer()
	}
	dispatcher.SetNetworkServer(wsServer)
	dispatcher.SetPendingRequestState(stateHandler)
	s := Server{Endpoint: Endpoint{}, server: wsServer, RequestState: stateHandler, dispatcher: dispatcher}
	for _, profile := range profiles {
		s.AddProfile(profile)
	}
	return &s
}
func (s *Server) SetRequestHandler(handler RequestHandler) {
	s.requestHandler = handler
}
func (s *Server) SetResponseHandler(handler ResponseHandler) {
	s.responseHandler = handler
}