exception handling in AEntity.toString