Skip to content

Commit

Permalink
Changed expected tuple error interface
Browse files Browse the repository at this point in the history
- Fixed issue with printing error when there is no error in client main
  • Loading branch information
madhavajay committed Oct 11, 2024
1 parent d30fd73 commit 5e63d43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions syftbox/app/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ def main(parser, args_list) -> None:
if args.command:
command = commands[args.command]
sys.argv = [sys.argv[0]] + remaining_args
error = command.execute(client_config)
if error is not None:
step, exception = error
print(f"Error during {step}: ", str(exception))
result = command.execute(client_config)
if result is not None:
# we should make this a type
if isinstance(result, tuple):
step, exception = result
print(f"Error during {step}: ", str(exception))
else:
parser.print_help()
3 changes: 1 addition & 2 deletions syftbox/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,12 @@ def main() -> None:
reload=debug,
reload_dirs="./syftbox",
)
break # If successful, exit the loop
return # If successful, exit the loop
except SystemExit as e:
if e.code != 1: # If it's not the "Address already in use" error
raise
print(f"Failed to start server on port {port}. Trying next port.")
port = 0

print(f"Unable to find an available port after {max_attempts} attempts.")
sys.exit(1)

Expand Down

0 comments on commit 5e63d43

Please sign in to comment.