Skip to content

Commit

Permalink
Check return_value
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecko committed Jul 3, 2020
1 parent e0423d5 commit b3cf109
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions owfmodules/avrisp/flash_erase.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def process(self):
# Erase the target chip
self.erase(spi_interface, reset, device)

def run(self):
def run(self, return_value=False):
"""
Main function.
Erase the flash memory of an AVR device.
Expand All @@ -94,10 +94,13 @@ def run(self):
return
try:
self.process()
return True
if return_value:
return True
except ValueError as err:
self.logger.handle(err, self.logger.ERROR)
return False
if return_value:
return False
except Exception as err:
self.logger.handle("{}: {}".format(type(err).__name__, err), self.logger.ERROR)
return False
if return_value:
return False

0 comments on commit b3cf109

Please sign in to comment.