Skip to content

Initialize SMTP exception messages through the superclass - #103

Open
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/errors-smtp
Open

Initialize SMTP exception messages through the superclass#103
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/errors-smtp

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Initialize the superclass exception message and use standard Exception rendering/copy behavior. SMTP errors currently override message without initializing Exception, so to_s loses the message and exception("replacement") continues returning the old message.

Reproduction

require 'net/smtp'
error = Net::SMTPFatalError.new('local failure')
p [error.message, error.to_s, error.exception('replacement').message]
# Before: ["local failure", "Net::SMTPFatalError", "local failure"]
# After:  ["local failure", "local failure", "replacement"]

Verification

  • 336 focused checks across all six SMTP exception classes cover String/Response inputs, explicit and empty messages, response identity, replacement copying, original-message retention, backtraces and Marshal round trips. Sixty failed expectations before; zero after.
  • Existing rake test: 95 tests, 170 assertions, zero failures/errors, on baseline and this isolated branch, Ruby 4.0.6 via rbenv. Existing local TLS cases are included.
  • Supplemental RuboCop Lint has the same six existing findings; Ruby syntax and git diff --check pass. No new/modified repository tests, dependencies or workflow settings.
  • Independent branch based on c2e9102e1f199a5a10e5261a776d752e64cc130f; runtime matches released 0.5.1. External focused checks were used under the consumer repository's no-new-tests policy.

Compatibility and limits

The required response argument and message: keyword remain unchanged; this does not reopen the zero-argument constructor policy in closed #48. Related merged #42 added String construction. Intentional corrections: to_s now shows the message and exception(replacement) honors replacement. The default response message is captured at construction rather than re-read after later mutation of the response. Other Ruby/OS runtimes were not run locally. No production or external SMTP delivery was used. Maintainer CI status is separate from these local checks.

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.

Net::SMTPError types interface changed in a patch release 0.2.2

1 participant