Added a report error function