fix: use Carp for error messages to report caller location#58
Draft
fix: use Carp for error messages to report caller location#58
Conversation
Module errors now point to the caller's code instead of IO::Stty internals. die→croak for the no-args error, warn→carp for invalid parameters, unknown baud rates, and unrecognized char values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.
What
Switch
die/warntoCarp::croak/carpso error messages point to the caller's code, not IO::Stty internals.Why
When a user passes invalid parameters to
stty(), the error message currently says "at lib/IO/Stty.pm line 503" — useless for debugging. Withcroak/carp, it reports the line in their code that made the bad call. Standard practice for CPAN modules.How
die("No parameters passed to stty")→croak(...)— the only fatal errorwarncalls →carp(removed trailing\nso Carp appends caller info)use Carp;Testing
All 147 tests pass (including POD coverage). Existing warning-capture tests use substring regex matching, so the added caller info doesn't break them.
🤖 Generated with Claude Code
Quality Report
Changes: 1 file changed, 7 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: 1 issue(s)
Generated by Kōan post-mission quality pipeline