Skip to content

Commit

Permalink
issue #361: Improve error message in windows when running apio driver…
Browse files Browse the repository at this point in the history
…s --ftdi-enable
  • Loading branch information
Obijuan committed Mar 26, 2024
1 parent 6965024 commit 59ced98
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apio/managers/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ def _ftdi_enable_windows(self):
zadig_ini_path = drivers_share_dir / "zadig.ini"
zadig_ini = Path("zadig.ini")

# -- TODO: Refactor: too many opertions inside the try
# -- Divide it into smaller operations and document it

try:
if util.check_package(
self.name, self.version, self.spec_version, drivers_bin_dir
Expand All @@ -425,8 +428,19 @@ def _ftdi_enable_windows(self):
click.secho("FTDI drivers configuration finished", fg="green")
else:
result = 1

# -- TODO: Check what type of exception is raised in windows
# -- and change "Exception" by the specific exception type
except Exception as exc:
click.secho("Error: " + str(exc), fg="red")
click.secho(
"Trying to execute zadig.exe in command line, "
"but an error ocurred"
)
click.secho(
"Please, execute the command again in the command line with"
" administrator privilegdes"
)
result = 1
finally:
# Remove zadig.ini
Expand Down

0 comments on commit 59ced98

Please sign in to comment.