Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pyfatfs/_exceptions.py: 75%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1# -*- coding: utf-8 -*- 

2 

3"""Custom Exceptions for PyFAT.""" 

4 

5 

6class PyFATException(Exception): 

7 """Generic PyFAT Exceptions.""" 

8 

9 def __init__(self, msg: str, errno=None): 

10 """Construct base class for PyFAT exceptions. 

11 

12 :param msg: Exception message describing what happened 

13 :param errno: Error number, mostly based on POSIX errno where feasible 

14 """ 

15 Exception.__init__(self, msg) 

16 self.errno = errno 

17 

18 

19class NotAnLFNEntryException(PyFATException): 

20 """Indicates that given dir entry cannot be interpreted as LFN entry.""" 

21 

22 

23class BrokenLFNEntryException(PyFATException): 

24 """Indicates that given LFN entry is invalid.""" 

25 

26 

27class NotAFatEntryException(NotADirectoryError): 

28 """Custom handling for FAT `NotADirectoryError`'s.""" 

29 

30 def __init__(self, msg: str, free_type: int): 

31 """Construct base class for PyFAT exceptions. 

32 

33 :param msg: Exception message describing what happened 

34 :param free_type: `FATDirectoryEntry._FREE_DIR_ENTRY_MARK` or 

35 `FATDirectoryEntry._LAST_DIR_ENTRY_MARK` 

36 """ 

37 NotADirectoryError.__init__(self, msg) 

38 self.free_type = free_type