git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Git.pm: better error message

From
Philippe Bruhat (BooK) <book@cpan.org>
Date
Jun 17, 2010, 23:47 UTC
Message-ID
<1276818451-17003-1-git-send-email-book@cpan.org>
In-Reply-To
<1276477222-21465-1-git-send-email-book@cpan.org>
Provide the bad directory name alongside with $!
Note: $! is set if there is "No such file or directory",
but isn't set if the file exists but is not a directory.
Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
---
 perl/Git.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index 1926dc9..6cb0dd1 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -172,7 +172,7 @@ sub repository {
 	}
 
 	if (defined $opts{Directory}) {
-		-d $opts{Directory} or throw Error::Simple("Directory not found: $!");
+		-d $opts{Directory} or throw Error::Simple("Directory not found: $opts{Directory} $!");
 
 		my $search = Git->repository(WorkingCopy => $opts{Directory});
 		my $dir;
@@ -545,7 +545,7 @@ sub wc_chdir {
 		or throw Error::Simple("bare repository");
 
 	-d $self->wc_path().'/'.$subdir
-		or throw Error::Simple("subdir not found: $!");
+		or throw Error::Simple("subdir not found: $subdir $!");
 	# Of course we will not "hold" the subdirectory so anyone
 	# can delete it now and we will never know. But at least we tried.
 
-- 
1.7.0.4
Previous: Jeff King
Message 5 of 5 in “Git.pm: better error message”
  1. Git.pm: better error messagePhilippe Bruhat (BooK), Jun 14, 2010
  2. Jeff KingJun 14, 2010
  3. Philippe Bruhat (BooK)Jun 14, 2010
  4. Jeff KingJun 14, 2010
  5. Git.pm: better error messagePhilippe Bruhat (BooK), Jun 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.