Skip to content

fix: early return if an exception is thrown while command parsing#111

Merged
ComixHe merged 1 commit into
OpenAtom-Linyaps:masterfrom
ComixHe:master
Aug 25, 2025
Merged

fix: early return if an exception is thrown while command parsing#111
ComixHe merged 1 commit into
OpenAtom-Linyaps:masterfrom
ComixHe:master

Conversation

@ComixHe

@ComixHe ComixHe commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

According the documentation of CLI11, this library will throw a exception while encounter -h,--help or a parse error.

According the documentation of CLI11, this library will throw a exception
while encounter -h,--help or a parse error.

Signed-off-by: ComixHe <ComixHe1895@outlook.com>
@ComixHe
ComixHe merged commit e62d7d5 into OpenAtom-Linyaps:master Aug 25, 2025
13 of 15 checks passed
@deepsource-io

deepsource-io Bot commented Aug 25, 2025

Copy link
Copy Markdown

Here's the code health analysis summary for commits 2b51656..31ea38f. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource C & C++ LogoC & C++❌ Failure
❗ 8 occurences introduced
View Check ↗
DeepSource Shell LogoShell✅ SuccessView Check ↗
DeepSource Secrets LogoSecrets✅ SuccessView Check ↗
DeepSource Test coverage LogoTest coverage⚠️ Artifact not reportedTimed out: Artifact was never reportedView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Comment on lines 112 to +114
} catch (const CLI::ParseError &e) {
options.global.return_code = app.exit(e);
return options;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling in the catch block uses app.exit(e) to set the return code and handle the exception. While this centralizes error handling, it's important to ensure that this method provides adequate user feedback and error logging. If app.exit(e) does not log errors or inform the user appropriately, consider enhancing its implementation or adding additional logging before exiting.

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