Log the exception rather than ignoring it, Fix #5160
Merge pull request #5164 from basepi/stateconf5160

Log the exception rather than ignoring it, Fix #5160