Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1341 #1376

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix 1341 #1376

wants to merge 4 commits into from

Conversation

biniabokouame
Copy link

Improved Error Handling for the khal new -i Command

Identified Issue
When creating an event interactively with khal new -i, an error in one field (e.g., datetime range) forces the user to restart the entire input process, even if other fields are correct. This makes the user experience frustrating and inefficient.

Proposed Solution
This fix improves the new_interactive function by:

  1. Handling errors iteratively:
    • When an invalid input is detected, the user receives a clear error message and can correct only the problematic field.
  2. Allowing cancellation:
    • If the user enters an empty value, the process is canceled without restarting the application.
  3. Simplifying the user experience:
    • Valid data is retained, and only the incorrect fields are re-entered.

Changes Made

  • Added a while True loop to manage field validation one by one.
  • Error handling with a try-except block to capture and display error messages.
  • The user can cancel event creation by entering an empty field.

Benefits

  • Enhances the user experience during interactive input.
  • Reduces frustration caused by repeated errors.
  • Provides a flexible and intuitive way to correct invalid inputs.

Testing Instructions

  1. Run the khal new -i command.
  2. Provide valid fields and one invalid field (e.g., datetime range: 3d).
  3. Verify that:
    • An error message is shown for the invalid field.
    • The user can correct only that field without losing valid data.
    • Event creation continues once the input is corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant