Relax overly aggressive exception-well-formedness checks from 84e4e006
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / _Util.pm
index 98da93c..32fdf0c 100644 (file)
@@ -148,6 +148,7 @@ sub scope_guard (&) {
 sub is_exception ($) {
   my $e = $_[0];
 
+  # FIXME
   # this is not strictly correct - an eval setting $@ to undef
   # is *not* the same as an eval setting $@ to ''
   # but for the sake of simplicity assume the following for
@@ -158,7 +159,10 @@ sub is_exception ($) {
   {
     local $@;
     eval {
-      $not_blank = ($e ne '') ? 1 : 0;
+      # The ne() here is deliberate - a plain length($e), or worse "$e" ne
+      # will entirely obviate the need for the encolsing eval{}, as the
+      # condition we guard against is a missing fallback overload
+      $not_blank = ( $e ne '' );
       1;
     } or $suberror = $@;
   }
@@ -185,7 +189,7 @@ sub is_exception ($) {
       ));
 
       # workaround, keeps spice flowing
-      $not_blank = ("$e" ne '') ? 1 : 0;
+      $not_blank = !!( length $e );
     }
     else {
       # not blessed yet failed the 'ne'... this makes 0 sense...
@@ -207,7 +211,7 @@ sub is_exception ($) {
     . 'does) result in silent discarding of errors. DBIx::Class tries to '
     . 'work around this as much as possible, but other parts of your '
     . 'software stack may not be even aware of the problem. Please submit '
-    . 'a bugreport against the distribution containing %s.',
+    . 'a bugreport against the distribution containing %s',
 
       ($class) x 2,
     ));