mirror of
https://github.com/beetbox/beets.git
synced 2025-12-07 17:16:07 +01:00
replaygain: More descriptive backend errors
This avoids a bare `except:` to catch specific errors and give better messages when they fail. Should provide more insight to this trouble: https://groups.google.com/d/msg/beets-users/6d-TOg0SuPY/iL39tmo3rqUJ Also related to #874. Feedback from @yevgenybezman or others more familiar with the backend would be welcome.
This commit is contained in:
parent
983aac287b
commit
c5293df963
1 changed files with 18 additions and 12 deletions
|
|
@ -273,7 +273,17 @@ class GStreamerBackend(object):
|
|||
|
||||
try:
|
||||
import gi
|
||||
except ImportError:
|
||||
raise FatalReplayGainError(
|
||||
"Failed to load GStreamer: python-gi not found"
|
||||
)
|
||||
|
||||
try:
|
||||
gi.require_version('Gst', '1.0')
|
||||
except ValueError as e:
|
||||
raise FatalReplayGainError(
|
||||
"Failed to load GStreamer 1.0: {0}".format(e)
|
||||
)
|
||||
|
||||
from gi.repository import GObject, Gst, GLib
|
||||
# Calling GObject.threads_init() is not needed for
|
||||
|
|
@ -282,10 +292,6 @@ class GStreamerBackend(object):
|
|||
warnings.simplefilter("ignore")
|
||||
GObject.threads_init()
|
||||
Gst.init([sys.argv[0]])
|
||||
except:
|
||||
raise FatalReplayGainError(
|
||||
"Failed to load GStreamer; check that python-gi is installed"
|
||||
)
|
||||
|
||||
self.GObject = GObject
|
||||
self.GLib = GLib
|
||||
|
|
@ -498,7 +504,7 @@ class ReplayGainPlugin(BeetsPlugin):
|
|||
)
|
||||
except (ReplayGainError, FatalReplayGainError) as e:
|
||||
raise ui.UserError(
|
||||
'An error occurred in backend initialization: {0}'.format(e)
|
||||
'replaygain initialization failed: {0}'.format(e)
|
||||
)
|
||||
|
||||
def track_requires_gain(self, item):
|
||||
|
|
|
|||
Loading…
Reference in a new issue