From: Peter Rabbitson Date: Wed, 4 Nov 2009 09:55:35 +0000 (+0000) Subject: Cleanup exceptions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d3fdc7b81278f9ae2dad417d68815933f65842dd;p=dbsrgits%2FDBIx-Class-Historic.git Cleanup exceptions --- diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 6397e45..d0e8d73 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -26,11 +26,11 @@ sub last_insert_id { for my $col (@cols) { my $seq = ( $source->column_info($col)->{sequence} ||= $self->dbh_do('_dbh_get_autoinc_seq', $source, $col) ) - or $self->throw_exception( "could not determine sequence for " - . $source->name - . ".$col, please consider adding a " - . "schema-qualified sequence to its column info" - ); + or $self->throw_exception( sprintf( + 'could not determine sequence for column %s.%s, please consider adding a schema-qualified sequence to its column info', + $source->name, + $col, + )); push @values, $self->_dbh_last_insert_id ($self->_dbh, $seq); } @@ -69,11 +69,14 @@ sub _dbh_get_autoinc_seq { unless ( defined $seq_expr and $seq_expr =~ /^nextval\(+'([^']+)'::(?:text|regclass)\)/i ) { $seq_expr = '' unless defined $seq_expr; $schema = "$schema." if defined $schema && length $schema; - $self->throw_exception( "no sequence found for $schema$table.$col, check table definition, " - . "or explicitly set the 'sequence' for this column in the " - . $source->source_name - . " class" - ); + $self->throw_exception( sprintf ( + 'no sequence found for %s%s.%s, check the RDBMS table definition or explicitly set the '. + "'sequence' for this column in %s", + $schema ? "$schema." : '', + $table, + $col, + $source->source_name, + )); } return $1;