Exceptions

Inheritance diagram of musify.file.exception

Exceptions relating to file operations.

Exceptions:

FileError([file, message])

Exception raised for file errors.

InvalidFileType(filetype[, message])

Exception raised for unrecognised file types.

FileDoesNotExistError(path[, message])

Exception raised when a file cannot be found.

UnexpectedPathError(path[, message])

Exception raised when a path is invalid.

ImageLoadError([file, message])

Exception raised for errors in loading an image.

exception musify.file.exception.FileError(file=None, message=None)

Bases: MusifyError

Exception raised for file errors.

Parameters:
  • file (str | Path | None (default: None)) – The file type that caused the error.

  • message (str | None (default: None)) – Explanation of the error.

exception musify.file.exception.InvalidFileType(filetype, message='File type not recognised')

Bases: FileError

Exception raised for unrecognised file types.

Parameters:
  • filetype (str) – The file type that caused the error.

  • message (str (default: 'File type not recognised')) – Explanation of the error.

exception musify.file.exception.FileDoesNotExistError(path, message='File cannot be found')

Bases: FileError, FileNotFoundError

Exception raised when a file cannot be found.

Parameters:
  • path (str | Path) – The path that caused the error.

  • message (str (default: 'File cannot be found')) – Explanation of the error.

exception musify.file.exception.UnexpectedPathError(path, message='Invalid path given')

Bases: FileError

Exception raised when a path is invalid. Usually raised when a directory is given when a file was expected and vice versa.

Parameters:
  • path (str | Path) – The path that caused the error.

  • message (str (default: 'Invalid path given')) – Explanation of the error.

exception musify.file.exception.ImageLoadError(file=None, message=None)

Bases: FileError

Exception raised for errors in loading an image.