Smarty errors handling refactored