Permalink
Browse files

Improving error message when we fail to open a file while generating …

…pieces key for metadata
  • Loading branch information...
1 parent 1b60952 commit 4bb5057ff74d6b07ce9c670bbc874bf42709a77a @sanko committed Sep 16, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Net/BitTorrent/Torrent/Generator.pm
@@ -177,7 +177,9 @@ package Net::BitTorrent::Torrent::Generator;
);
my $data = '';
FILE: for my $f (@{$s->files}) {
- open(my ($fh), '<', $f) || confess 'Cannot generate .torrent';
+ open(my ($fh), '<', $f)
+ || confess sprintf
+ 'Cannot open "%s" to generate metadata: %s', $f, $!;
PIECE:
while (length $data < $s->piece_length) {
sysread($fh, $data, ($s->piece_length - length($data)),

0 comments on commit 4bb5057

Please sign in to comment.