Allow user to see actual error if a download has failed 
Author: festeh
Pull request: yes
Labels: name: wontfix

Fixes #5869. Adds new logic of exception handling.
* If there was a caught exception in `cached_path` during download, and `force_download` is True, then raise it
* If `force_download` is False, save this exception and raise it later, it file is not in local cache
* If download exception in `cached_path` was raised, then re-raise it in calling function. If there's no exception, but resolved file is None, keep old message ("...is a correct model identifier...")

It would be great to know if there's a better way to dealing with this issue.

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=h1) Report
> Merging [#5925](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/32883b310ba30d72e67bb2ebb5847888f03a90a8&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/5925/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #5925      +/-   ##
==========================================
- Coverage   78.51%   78.51%   -0.01%     
==========================================
  Files         146      146              
  Lines       26214    26214              
==========================================
- Hits        20583    20582       -1     
- Misses       5631     5632       +1     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/configuration\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5925/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX3V0aWxzLnB5) | `96.52% <ø> (ø)` | |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5925/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `81.19% <ø> (-0.30%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5925/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `88.88% <ø> (ø)` | |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5925/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `87.14% <ø> (ø)` | |
| [src/transformers/generation\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5925/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9nZW5lcmF0aW9uX3RmX3V0aWxzLnB5) | `86.46% <0.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=footer). Last update [32883b3...80220ae](https://codecov.io/gh/huggingface/transformers/pull/5925?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.