[BE] Better test stats errors (#83484)
When `BUILD_ENVIRONMENT` is not defined, print sensible error message
Which is better than:
```
Could not download https://raw.githubusercontent.com/pytorch/test-infra/generated-stats/stats/test-times.json because: 'BUILD_ENVIRONMENT'
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83484
Approved by: https://github.com/huydhn, https://github.com/ZainRizvi