Skip to content

Improve CLI validation and error handling#6

Open
AyushMohite08 wants to merge 1 commit intomaybe-adev:mainfrom
AyushMohite08:improve-cli-stability
Open

Improve CLI validation and error handling#6
AyushMohite08 wants to merge 1 commit intomaybe-adev:mainfrom
AyushMohite08:improve-cli-stability

Conversation

@AyushMohite08
Copy link

@AyushMohite08 AyushMohite08 commented Dec 15, 2025

📥 Pull Request

📝 Summary

What does this PR do?

This PR improves the stability, validation, and error handling of the Pearlen CLI.
It ensures invalid inputs and runtime errors are handled gracefully, without crashing the CLI or exposing raw Python tracebacks to users.


🔍 Related Issue

Closes: #4


✅ Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation update
  • 🔧 Build/CI update
  • ⚡ Performance improvement
  • 🚨 Security fix
  • Other (please describe):

📚 Description of Changes

This PR focuses on improving CLI reliability and user experience:

  • Added validation for .pearl file usage and file existence
  • Prevented CLI crashes on invalid input or interpreter errors
  • Ensured syntax and runtime errors are displayed cleanly without Python tracebacks
  • Improved REPL stability so errors do not terminate the interactive session
  • Handled graceful exit from REPL on EOF (Ctrl+Z + Enter on Windows)

The CLI now acts as a proper boundary layer, handling user-facing concerns while allowing interpreter errors to propagate cleanly.


🧪 Tests & Verification

  • Manual testing
  • Added/updated unit tests
  • All tests passing locally
  • Verified with sample input

Details:

  • Tested file execution with valid and invalid .pearl files
  • Tested missing file and invalid extension handling
  • Verified REPL stability across syntax and runtime errors
  • Tested exit behavior in interactive mode
  • Verified pearl <file>.pearl execution via pearl.bat on Windows

📸 Screenshots / Demos (If Applicable)

Not applicable for this change.


📦 Breaking Changes?

  • Yes
  • No

📘 Checklist

  • Code compiles without warnings
  • Tests pass
  • Code follows project style & guidelines
  • Comments added where needed
  • Documentation updated if required
  • No secrets or sensitive info included

🙏 Additional Notes

This PR does not modify lexer, parser, or evaluator logic.
Changes are intentionally scoped to CLI stability and error handling only.

@maybe-adev
Copy link
Owner

maybe-adev commented Jan 1, 2026

Can you refine the keyword error handling for keywords? Picture Attached where mainly I want change.
@AyushMohite08
Screenshot 2026-01-02 001602

@AyushMohite08
Copy link
Author

@maybe-adev
Can you please describe like what should be the expected behavior/output for a specific input.

@maybe-adev
Copy link
Owner

maybe-adev commented Jan 5, 2026

@maybe-adev Can you please describe like what should be the expected behavior/output for a specific input.

Okay, I am trying to explain by giving an example of an error:
showw("hello")
Error: showw is not a keyword [Error something like this]

Here error on showw("hello"): showw not an keyword but show is a keyword.

@maybe-adev
Copy link
Owner

Hey @AyushMohite08 ,
Are you working on this issue or should I reassign it?

@AyushMohite08
Copy link
Author

Thanks for checking in!
Currently I am not able to actively work on this issue for a while due to time constraints, so please feel free to reassign it or let others pick it up.

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.

2 participants