Check if json answer contains message argument before setting errorMsg.
Thanks to Jeremie Bordier.