Handle FreeDB server errors gracefully (#304)
* handle FreeDB server errors gracefully In my repeated tests, I ended up upsetting freedb.org, which started issuing 502 errors. Those errors are not correctly caught by the program which just crashes with a backtrace. Instead, we handle those like any other API error, which can already be generated by perform_lookup (but not handled). The visible result for the user is that the CD is simply not found on FreeDB, an acceptable compromise, in my opinion. Closes: #206 * harmonize an error message with other warnings ... which are all capitalized.
This commit is contained in:
@@ -251,10 +251,13 @@ class Program:
|
||||
logger.debug('CDDB query result: %r', md)
|
||||
return [item['DTITLE'] for item in md if 'DTITLE' in item] or None
|
||||
|
||||
except ValueError as e:
|
||||
self._stdout.write("WARNING: CDDB protocol error: %s\n" % e)
|
||||
|
||||
except IOError as e:
|
||||
# FIXME: for some reason errno is a str ?
|
||||
if e.errno == 'socket error':
|
||||
self._stdout.write("Warning: network error: %r\n" % (e, ))
|
||||
self._stdout.write("WARNING: CDDB network error: %r\n" % (e, ))
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
Reference in New Issue
Block a user