lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
277 stars 126 forks source link

Question on error handling #293

Open andig opened 2 months ago

andig commented 2 months ago

Hope it is ok to ask this question. I couldn't find this in the docs:

CS functions take a callback that already receives an error. What is the meaning of that received error and how does it relate to the error returned by the CS function? Example:

GetCompositeSchedule(clientId string, callback func(*smartcharging.GetCompositeScheduleConfirmation, error), connectorId int, duration int, props ...func(request *smartcharging.GetCompositeScheduleRequest)) error

CS handlers allow to return a confirmation and an error. What is the meaning of the returned error: is it in any way relayed to the CP? I.e. does returning an error create some sort or error response that is returned? Example:

OnMeterValues(chargePointId string, request *MeterValuesRequest) (confirmation *MeterValuesConfirmation, err error)

I'm not sure if the answers are obvious and I'm just missing them. If not it might nice to add them to the docs of CentralSystemHandler and ChargePointHandler in https://pkg.go.dev/github.com/lorenzodonini/ocpp-go@v0.18.0/ocpp1.6.