Fix null reference exception

When an internal Cobra exception occurred, the wrong error message
variable was being passed into the logger.