Make custom error variable scope larger