J0nesycat / forecast

weather forecast
MIT License
0 stars 0 forks source link

Input Validation and Error Handling #5

Closed NoaTeomi closed 6 hours ago

NoaTeomi commented 6 hours ago
  1. User Input Validation:

The get_validated_input function provides good feedback for incorrect inputs. However, consider specifying valid input options in the prompt itself, so users know what's expected from the beginning. Suggested Improvement: Could we enhance the prompt to clarify available options before the user inputs? This would reduce the number of invalid entries by providing clarity upfront.

  1. API Error Handling:

Logging of the 404 errors and printing the response status code and error message adds robustness. However, it would be beneficial to add a more user-friendly message along with the logged error. Suggested Improvement: Could we include a recommendation for users to double-check the city name or network connection when a 404 error occurs?

J0nesycat commented 6 hours ago

Thank you for the detailed feedback!

User Input Validation: This is now enhanced to guide users on expected inputs. If an invalid character is entered, users receive an error message displaying the valid options. For example: “Invalid input. Please enter one of the following: y, n.”

API Error Handling: The logging for 404 errors has been updated. Users will now see both the status code and a descriptive error message, providing more context.

Please check out these updates in release v1.0-input-validation. Thank you for the helpful insights!