]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
xhc_mset: improve error message formatting
authorEric Wong <e@80x24.org>
Thu, 29 May 2025 00:20:29 +0000 (00:20 +0000)
committerEric Wong <e@80x24.org>
Sun, 1 Jun 2025 10:15:49 +0000 (10:15 +0000)
We don't need extra linefeeds before the `)' in the stderr
output, and the context from croak() is bogus anyways since we
get error messages from an external process.

lib/PublicInbox/XhcMset.pm

index d6dc877f9e6c3bfbce072ca4b1e0dab7e43f33f1..fd359d0915440aa76c5d2cd48cba247ad47759a7 100644 (file)
@@ -10,7 +10,6 @@ use PublicInbox::IO qw(read_all);
 use PublicInbox::XhcMsetIterator;
 use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT);
 use Fcntl qw(SEEK_SET);
-use Carp qw(croak);
 use PublicInbox::Git qw(git_quote);
 
 sub die_err ($@) {
@@ -19,7 +18,7 @@ sub die_err ($@) {
        seek $err_rw, 0, SEEK_SET;
        my $s = read_all $err_rw;
        chomp $s;
-       croak $s, @msg;
+       die $s, @msg, "\n";
 }
 
 sub event_step {
@@ -41,7 +40,7 @@ sub event_step {
                scalar(@it) == $size or die_err $self,
                        'got ', scalar(@it), ', expected mset.size=', $size;
        };
-       my $err = $@;
+       chomp(my $err = $@);
        $self->close;
        eval { $cb->(@args, $self, $err) };
        warn "E: $@\n" if $@;