update error reporting function