Skip to content

Commit

Permalink
Merge pull request #12 from prompt-security/fix_value_error_handling
Browse files Browse the repository at this point in the history
Fix wrong value (out of range, etc) entry handling
  • Loading branch information
vitaly-ps authored Apr 15, 2024
2 parents f3d6c68 + 27c2461 commit e9eb6df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ps_fuzz/interactive_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def show(cls, state: AppConfig):
print("----------------------------------------------------")
result = inquirer.prompt([
inquirer.Text('debug_level',
message="Debug Level (0-3)",
message="Debug Level (0-2) (0=warnings and errors; 1 = normal; 2 = verbose)",
default=str(state.debug_level),
validate=lambda _, x: x.isdigit() and int(x) > 0
),
Expand Down Expand Up @@ -171,6 +171,8 @@ def interactive_shell(state: AppConfig):
except KeyboardInterrupt:
print("\nOperation cancelled by user.")
continue
except ValueError as e:
logger.warning(f"{colorama.Fore.RED}{colorama.Style.BRIGHT}Wrong value:{colorama.Style.RESET_ALL} {e}")
except Exception as e:
logger.error(f"An error occurred: {e}", exc_info=True)
break

0 comments on commit e9eb6df

Please sign in to comment.