Add session validation checks before executing vehicle commands
Some checks failed
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Failing after 27s

This commit is contained in:
2025-07-08 16:32:45 -04:00
parent 30bd0bde44
commit e8a1d8f54e
2 changed files with 19 additions and 7 deletions

View File

@ -451,7 +451,7 @@ func (v *Vehicle) GetClimatePresets() error {
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}
@ -517,7 +517,7 @@ func (v *Vehicle) GetClimateQuickPresets() error {
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}
@ -560,7 +560,7 @@ func (v *Vehicle) GetClimateUserPresets() error {
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}
@ -612,7 +612,7 @@ func (v *Vehicle) GetVehicleStatus() error {
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}
@ -680,7 +680,7 @@ func (v *Vehicle) GetVehicleCondition() error {
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}
@ -737,7 +737,7 @@ func (v *Vehicle) GetVehicleHealth() error {
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}
@ -802,7 +802,7 @@ func (v *Vehicle) executeServiceRequest(params map[string]string, reqUrl, pollin
}
// Validate session before executing the request
if v.client.validateSession() {
if !v.client.validateSession() {
v.client.logger.Error(APP_ERRORS["SESSION_EXPIRED"])
return errors.New(APP_ERRORS["SESSION_EXPIRED"])
}