Skip to content

Replace exit calls with exceptions in morse code#3179

Open
ANIKET640-a11y wants to merge 1 commit into
TheAlgorithms:masterfrom
ANIKET640-a11y:fix-morse-invalid-input
Open

Replace exit calls with exceptions in morse code#3179
ANIKET640-a11y wants to merge 1 commit into
TheAlgorithms:masterfrom
ANIKET640-a11y:fix-morse-invalid-input

Conversation

@ANIKET640-a11y

Copy link
Copy Markdown

Describe your change:

Fixes #3176

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change tests?
  • Documentation change?

Replaced std::exit(0) calls in char_to_morse() and morse_to_char() with std::invalid_argument exceptions.

This prevents the library from terminating the caller's process on invalid input and avoids exiting with a success status code when an error occurs.

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file.

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.

ciphers/morse_code: char_to_morse/morse_to_char call std::exit(0) on invalid input (library kills caller's process, with success code)

1 participant