Add hooks to customize error output