Should set() die or _croak on "No such column"?

[prev] [thread] [next] [Date index for 2005/07/07]

From: George Hartzell
Subject: Should set() die or _croak on "No such column"?
Date: 19:13 on 07 Jul 2005
Hi all,

I was playing around with setting up my own exception handling, and
the first thing that I thought to try was referencing a column that
didn't exist.

It seems that that is the one thing that causes Class:DBI to actually
die() instead of $self->_croak().

Is there a strong reason for it to be that way, or would something
like the following patch-let make sense?

g.

*** lib/Class/DBI.pm.orig	Thu Jul  7 10:58:06 2005
--- lib/Class/DBI.pm	Thu Jul  7 10:59:45 2005
***************
*** 868,872 ****
  
  	while (my ($column, $value) = each %$column_values) {
! 		my $col = $self->find_column($column) or die "No such column: $column\n";
  		$self->_attribute_set($col => $value);
  
--- 868,873 ----
  
  	while (my ($column, $value) = each %$column_values) {
! 		my $col = $self->find_column($column) or 
! 			$self->_croak("No such column: $column");
  		$self->_attribute_set($col => $value);
  

Should set() die or _croak on "No such column"?
George Hartzell 19:13 on 07 Jul 2005

Generated at 16:36 on 28 Jul 2005 by mariachi v0.52