add common error handler