Skip to content

Commit

Permalink
Replace hardcoded error values with enums
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed Dec 2, 2023
1 parent a286289 commit 8504ed7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/littlefs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def mkdir(self, path: str) -> int:
try:
return lfs.mkdir(self.fs, path)
except errors.LittleFSError as e:
if e.code == -17:
if e.code == LittleFSError.Error.LFS_ERR_EXIST:
msg = "[LittleFSError {:d}] Cannot create a file when that file already exists: '{:s}'.".format(
e.code, path
)
Expand Down Expand Up @@ -316,7 +316,7 @@ def removedirs(self, name):
break
self.remove('/'.join(parts))
except errors.LittleFSError as e:
if e.code == -39:
if e.code == LittleFSError.Error.LFS_ERR_NOTEMPTY:
break
raise e
parts.pop()
Expand Down

0 comments on commit 8504ed7

Please sign in to comment.