report_error function

Report errors and warnings