mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-08 20:39:08 +00:00
Refactor exceptions
* Suffix names for custom exceptions with "Error" * Introduce exceptions for when the coressponding encoder isn't found
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import shutil
|
||||
import os
|
||||
|
||||
from abc import ABC
|
||||
from abc import abstractmethod
|
||||
|
||||
from spotdl.encode.exceptions import EncoderNotFoundError
|
||||
|
||||
"""
|
||||
NOTE ON ENCODERS
|
||||
================
|
||||
@@ -25,6 +28,12 @@ from abc import abstractmethod
|
||||
class EncoderBase(ABC):
|
||||
@abstractmethod
|
||||
def __init__(self, encoder_path, loglevel, additional_arguments):
|
||||
if shutil.which(encoder_path) is None:
|
||||
raise EncoderNotFoundError(
|
||||
"{} executable does not exist or was not found in PATH.".format(
|
||||
encoder_path
|
||||
)
|
||||
)
|
||||
self.encoder_path = encoder_path
|
||||
self._loglevel = loglevel
|
||||
self._additional_arguments = additional_arguments
|
||||
|
||||
Reference in New Issue
Block a user