Problem with logging of the last error

Hi, we are using the $config->maxErrorCount on eXpansion and noticed that when the system stopped due to that we had a missing error message. 
SO just called displayAndLogError before increaseErrorCount to fix it. 

also added a message to see why it has ended