logging added in error handler