Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please do not die on errors #6

Open
martinthurn opened this issue Feb 4, 2015 · 5 comments
Open

Please do not die on errors #6

martinthurn opened this issue Feb 4, 2015 · 5 comments

Comments

@martinthurn
Copy link

Some (most? all?) of the methods die if there is an error. For example, try to append onto a file that does not exist. Please DO NOT DIE on errors, that's what the return value of Boolean is for!

@tagomoris
Copy link
Owner

Dying is not in my design. Is it contain messages like NameNode returns non-redirection (or without location header)?
If so, it is bug. Please show me dying message.

@martinthurn
Copy link
Author

You are calling croak, which is the same as die. Instead of calling croak, you should save the error message somewhere and return 0, I think.

@tagomoris
Copy link
Owner

Calling croak is under my decision. But it is abnormal situation, and I need to know what situation makes such case.
Please tell me whether dying message is Namenode returns non-redirection or not.

@martinthurn
Copy link
Author

For example, call stat() on a file that does not exist.

my $rh = $o->stat(q{/no/such/file});
print "after the stat call\n";

This code dies with a JSON error (see below), it never prints "after the
stat call" and I have no chance of doing anything if the file does not
exist.

FileNotFoundError: {"RemoteException":{"message":"File does not exist:
/no/such/file","exception":"FileNotFoundException","javaClassName":"
java.io.FileNotFoundException"}} at hdfs-loader.pl line 105

  • - Martin

On Sun, Mar 1, 2015 at 9:07 AM, TAGOMORI Satoshi notifications@github.com
wrote:

Calling croak is under my decision. But it is abnormal situation, and I
need to know what situation makes such case.
Please tell me whether dying message is Namenode returns non-redirection
or not.


Reply to this email directly or view it on GitHub
#6 (comment)
.

@tagomoris
Copy link
Owner

I've just added suppress_errors option to client at master:HEAD.

my $client = Net::Hadoop::WebHDFS->new(..., suppress_errors => 1);
unless ($client->stat(q{/no/such/file})) {
  say $client->{last_error};
}

Can you test it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants