Conversation
…s unknown Signed-off-by: dfayd0 <78728332+dfayd0@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a fallback prompt loop when the configured or provided default language is invalid, adjusts error types for parsing languages, and extends the API runner with helper methods for fetching problem details.
- Changed
parse_programming_languageto returnstd::io::Errorand added a re-prompt functionprompt_for_language - Updated
main.rsto loop on invalid language input until a supported language is entered - Introduced
get_problem_nameandget_available_languagesin the API runner and improved client initialization error handling
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/utils.rs | Changed parse errors to io::Error, added prompt_for_language |
| src/main.rs | Integrated prompt loop for default language and retry logic |
| src/leetcode_api_runner.rs | Added get_problem_name, get_available_languages, and enhanced error handling in client setup |
Comments suppressed due to low confidence (2)
src/utils.rs:37
- Using
std::io::Errorto represent a language-parse failure is misleading since this isn't an I/O operation. Consider defining a domain-specific error enum or custom error type to clearly represent parsing errors.
) -> Result<leetcoderustapi::ProgrammingLanguage, std::io::Error> {
src/utils.rs:166
- The new
prompt_for_languagelogic isn't covered by existing tests. Consider adding unit or integration tests to validate input handling and retry behavior.
pub fn prompt_for_language(
Signed-off-by: dfayd0 <78728332+dfayd0@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.