Subject: | I really beg you to take back the exception catching feature in Future 0.11 |
I really beg you to take back the new feature in Future 0.11, in which
exceptions are caught by Future in followed_by(), and_then() and
or_else() callbacks.
This is because it can unintensionally hide critical errors and lead
to hard-to-solve bugs.
Suppose I use a function from someone's module.
package Someones::Module;
sub bad_func {
die __PACKAGE__ . ": something bad happened.";
}
It is often the case that a function throws an exception in some cases.
And sometimes it is NOT EVEN DOCUMENTED.
Then, when I use it in Future's callback,
package main;
my $start = Future->new;
$start->and_then(sub {
my ($arg) = shift->get;
my $result = Someones::Module::bad_func($arg);
print "We get the result: $result";
return Future->new->done($result);
});
$start->done('a');
with Future 0.11, the above code prints nothing. If I didn't read
Future's documentation from page to page, I would have no idea what's
going on.
The thrown exception lives in the sense that it makes the resulting
future fail. However, the failed future can be easily ignored unless
the user has explicit intension to check errors. I believe errors as
important as exceptions must be visible regardless of the user's
intension or carefulness.
Therefore, I really beg you to take back the exception catching
feature in Future 0.11.