Skip Menu |

This queue is for tickets about the Net-SFTP-Foreign CPAN distribution.

Report information
The Basics
Id: 89211
Status: rejected
Priority: 0/
Queue: Net-SFTP-Foreign

People
Owner: Nobody in particular
Requestors: tmetro [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.75
Fixed in: (no value)



Subject: error message formatting
Seen in your documentation: $sftp = Net::SFTP::Foreign->new($host, autodie => 1); my $ls = $sftp->ls("/bar"); # dies as: "Couldn't open remote dir '/bar': No such file" I recommend following the UNIX error message convention of $object: $message. So that would become: /bar: couldn't open remote dir: No such file So you start with the $object being operated on, follow by a high-level explanation of the operation that failed, and then append any error messages obtained from the OS or lower-level API calls. Similarly: $sftp->die_on_error("Something bad happened"); # is a shortcut for... $sftp->error and die "Something bad happened: " . $sftp->error; should be more like: $sftp->die_on_error($object, "something bad happened"); # is a shortcut for... $sftp->error and die join(': ',$object, 'something bad happened', $sftp->error) . "\n"; Of course error message formatting is a matter of personal preference, but there is a long history of precedence for this format.
On Wed Oct 02 16:11:43 2013, TMETRO wrote: Show quoted text
> Seen in your documentation: > > $sftp = Net::SFTP::Foreign->new($host, autodie => 1); > my $ls = $sftp->ls("/bar"); > # dies as: "Couldn't open remote dir '/bar': No such file" > > I recommend following the UNIX error message convention of $object: > $message. So that would become: > > /bar: couldn't open remote dir: No such file > > So you start with the $object being operated on, follow by a high- > level explanation of the operation that failed, and then append any > error messages obtained from the OS or lower-level API calls. > > Similarly: > > $sftp->die_on_error("Something bad happened"); > # is a shortcut for... > $sftp->error and die "Something bad happened: " . $sftp->error; > > should be more like: > > $sftp->die_on_error($object, "something bad happened"); > # is a shortcut for... > $sftp->error > and die join(': ',$object, 'something bad happened', $sftp->error) . > "\n"; > > Of course error message formatting is a matter of personal preference, > but there is a long history of precedence for this format.
Changing all the error messages at this point may break lot of user scripts, I am not going to do it.