diff --git a/beets/library.py b/beets/library.py index 8e6f75c1c..b5e60d657 100644 --- a/beets/library.py +++ b/beets/library.py @@ -23,6 +23,7 @@ import shlex import unicodedata import threading import contextlib +import traceback from collections import defaultdict from unidecode import unidecode from beets.mediafile import MediaFile @@ -283,7 +284,12 @@ class Item(object): f = MediaFile(syspath(self.path)) for key in ITEM_KEYS_WRITABLE: setattr(f, key, getattr(self, key)) - f.save() + + try: + f.save() + except (OSError, IOError) as exc: + raise util.FilesystemError(exc, 'write', (self.path,), + traceback.format_exc()) # The file has a new mtime. self.mtime = self.current_mtime() diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 6c29c7c0e..e311692a9 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -93,7 +93,7 @@ class FilesystemError(HumanReadableException): clause = 'while {0} {1} to {2}'.format( self._gerund(), repr(self.paths[0]), repr(self.paths[1]) ) - elif self.verb in ('delete',): + elif self.verb in ('delete', 'write'): clause = 'while {0} {1}'.format( self._gerund(), repr(self.paths[0]) ) diff --git a/docs/changelog.rst b/docs/changelog.rst index 00b409baa..9b71d2d1a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -29,6 +29,7 @@ Changelog modify files' tags even when they successfully change the database. * Fix a VFS bug leading to a crash in the :doc:`/plugins/bpd` when files had non-ASCII extensions. +* Add a human-readable error message when writing files' tags fails. .. _Tomahawk resolver: http://beets.radbox.org/blog/tomahawk-resolver.html