Skip to content

Commit

Permalink
feat(exc): PyDeviceFileIntegrityError exception.
Browse files Browse the repository at this point in the history
Signed-off-by: Braden Mars <bradenmars@bradenmars.me>
  • Loading branch information
BradenM committed Apr 17, 2023
1 parent 1819197 commit a2187c8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions micropy/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Micropy Exceptions."""
from __future__ import annotations


class MicropyException(Exception):
Expand Down Expand Up @@ -61,3 +62,16 @@ class PyDeviceConnectionError(PyDeviceError):

def __init__(self, location: str):
super().__init__(self._default_message.format(location=location))


class PyDeviceFileIntegrityError(PyDeviceError):
_default_message = (
"Failed to verify integrity: {device_path} (device={device_sum}, recv={digest})"
)

def __init__(self, device_path: str, device_sum: str, digest: str):
super().__init__(
self._default_message.format(
device_path=device_path, device_sum=device_sum, digest=digest
)
)

0 comments on commit a2187c8

Please sign in to comment.