goodmami / wn

A modern, interlingual wordnet interface for Python
https://wn.readthedocs.io/
MIT License
197 stars 19 forks source link

Downloading is not properly detecting error responses #147

Closed goodmami closed 2 years ago

goodmami commented 2 years ago

When downloading a resource, Wn will detect if an exception was thrown, but not if the server returned a valid error message (e.g., status 404 or 500). The current error message to the user is not very helpful:

>>> wn.download('ewn:2020')  # currently returning 500 Server Error
Download (0 bytes) Complete

Traceback (most recent call last):
  ...
wn.Error: not a valid lexical resource: /home/goodmami/.wn_data/downloads/3d808000775f658597bc71e9d4870059ccc7965f

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  ...
wn.Error: could not add downloaded file: /home/goodmami/.wn_data/downloads/3d808000775f658597bc71e9d4870059ccc7965f
  You might try deleting the cached file and trying the download again.

It would be better if the user got a message that the server was giving an error and not that the (empty) file is somehow invalid.