$parser->$method($value);
}
catch {
- $self->throw_exception ("Error while inflating ${value} for $info->{__dbic_colname} on ${self}: $_")
+ $self->throw_exception ("Error while inflating '$value' for $info->{__dbic_colname} on ${self}: $_")
unless $info->{datetime_undef_if_invalid};
undef; # rv
};
}
};
} elsif ($acc_type eq 'filter') {
- $class->throw_exception("No such column $rel to filter")
+ $class->throw_exception("No such column '$rel' to filter")
unless $class->has_column($rel);
my $f_class = $class->relationship_info($rel)->{class};
$class->inflate_column($rel,
},
deflate => sub {
my ($val, $self) = @_;
- $self->throw_exception("$val isn't a $f_class") unless $val->isa($f_class);
+ $self->throw_exception("'$val' isn't a $f_class") unless $val->isa($f_class);
return ($val->_ident_values)[0];
# WARNING: probably breaks for multi-pri sometimes. FIXME
}
$meth{"${rel}_rs"} = sub { shift->search_related_rs($rel, @_) };
$meth{"add_to_${rel}"} = sub { shift->create_related($rel, @_); };
} else {
- $class->throw_exception("No such relationship accessor type $acc_type");
+ $class->throw_exception("No such relationship accessor type '$acc_type'");
}
{
no strict 'refs';
unless ref $self;
my $rel = shift;
my $rel_info = $self->relationship_info($rel);
- $self->throw_exception( "No such relationship ${rel}" )
+ $self->throw_exception( "No such relationship '$rel'" )
unless $rel_info;
return $self->{related_resultsets}{$rel} ||= do {
# keep in mind that the following if() block is part of a do{} - no return()s!!!
if ($is_crosstable) {
$self->throw_exception (
- "A cross-table relationship condition returned for statically declared '$rel'")
- unless ref $rel_info->{cond} eq 'CODE';
+ "A cross-table relationship condition returned for statically declared '$rel'"
+ ) unless ref $rel_info->{cond} eq 'CODE';
# A WHOREIFFIC hack to reinvoke the entire condition resolution
# with the correct alias. Another way of doing this involves a
my $rsrc = $self->result_source;
my $rel_info = $rsrc->relationship_info($rel)
- or $self->throw_exception( "No such relationship ${rel}" );
+ or $self->throw_exception( "No such relationship '$rel'" );
if (defined $f_obj) {
my $f_class = $rel_info->{class};
- $self->throw_exception( "Object $f_obj isn't a ".$f_class )
+ $self->throw_exception( "Object '$f_obj' isn't a ".$f_class )
unless blessed $f_obj and $f_obj->isa($f_class);
}
$class->ensure_class_loaded($f_class);
my %f_primaries = map { $_ => 1 } try { $f_class->_pri_cols }
catch {
- $class->throw_exception( "Can't infer join condition for ${rel} on ${class}: $_");
+ $class->throw_exception( "Can't infer join condition for '$rel' on ${class}: $_");
};
my ($pri, $too_many) = keys %f_primaries;
$class->throw_exception(
- "Can't infer join condition for ${rel} on ${class}; ".
- "${f_class} has multiple primary keys"
+ "Can't infer join condition for '$rel' on ${class}: "
+ . "${f_class} has multiple primary keys"
) if $too_many;
my $fk = defined $cond ? $cond : $rel;
$class->throw_exception(
- "Can't infer join condition for ${rel} on ${class}; ".
- "$fk is not a column of $class"
+ "Can't infer join condition for '$rel' on ${class}: "
+ . "'$fk' is not a column of $class"
) unless $class->has_column($fk);
$cond = { "foreign.${pri}" => "self.${fk}" };
$class->ensure_class_loaded($f_class);
my ($pri, $too_many) = try { $class->_pri_cols }
catch {
- $class->throw_exception("Can't infer join condition for ${rel} on ${class}: $_");
+ $class->throw_exception("Can't infer join condition for '$rel' on ${class}: $_");
};
$class->throw_exception(
my $f_class_loaded = try { $f_class->columns };
$class->throw_exception(
- "No such column ${f_key} on foreign class ${f_class} ($guess)"
+ "No such column '$f_key' on foreign class ${f_class} ($guess)"
) if $f_class_loaded && !$f_class->has_column($f_key);
$cond = { "foreign.${f_key}" => "self.${pri}" };
$guess = "using primary key of foreign class for foreign key";
}
$class->throw_exception(
- "No such column ${f_key} on foreign class ${f_class} ($guess)"
+ "No such column '$f_key' on foreign class ${f_class} ($guess)"
) if $f_class_loaded && !$f_class->has_column($f_key);
$cond = { "foreign.${f_key}" => "self.${pri}" };
}
# warning
return unless $self_id =~ /^self\.(.*)$/;
my $key = $1;
- $class->throw_exception("Defining rel on ${class} that includes ${key} but no such column defined here yet")
+ $class->throw_exception("Defining rel on ${class} that includes '$key' but no such column defined here yet")
unless $class->has_column($key);
my $column_info = $class->column_info($key);
if ( $column_info->{is_nullable} ) {
next;
}
}
- $new->throw_exception("No such column $key on $class")
+ $new->throw_exception("No such column '$key' on $class")
unless $class->has_column($key);
$new->store_column($key => $attrs->{$key});
}
$columns_info->{$_}{is_auto_increment}
} keys %$columns_info;
- if (not $autoinc_col) {
- $self->throw_exception(
-'empty insert only supported for tables with an autoincrement column'
- );
- }
+ $self->throw_exception(
+ 'empty insert only supported for tables with an autoincrement column'
+ ) unless $autoinc_col;
my $table = $source->from;
$table = $$table if ref $table;
scalar $self->_extract_order_criteria ($attrs->{order_by})
) {
$self->throw_exception(
- 'An ordered subselect encountered - this is not safe! Please see "Ordered Subselects" in DBIx::Class::Storage::DBI::MSSQL
- ') unless $attrs->{unsafe_subselect_ok};
+ 'An ordered subselect encountered - this is not safe! Please see "Ordered Subselects" in DBIx::Class::Storage::DBI::MSSQL'
+ ) unless $attrs->{unsafe_subselect_ok};
my $max = $self->sql_maker->__max_int;
$sql =~ s/^ \s* SELECT \s/SELECT TOP $max /xi;
}
}
else {
$self->throw_exception( sprintf (
- "Unable to introspect trigger '%s' for column %s.%s (references multiple sequences). "
+ "Unable to introspect trigger '%s' for column '%s.%s' (references multiple sequences). "
. "You need to specify the correct 'sequence' explicitly in '%s's column_info.",
$triggers[0]{name},
$source_name,
}
else {
$self->throw_exception( sprintf (
- "Unable to reliably select a BEFORE INSERT trigger for column %s.%s (possibilities: %s). "
+ "Unable to reliably select a BEFORE INSERT trigger for column '%s.%s' (possibilities: %s). "
. "You need to specify the correct 'sequence' explicitly in '%s's column_info.",
$source_name,
$col,
}
$self->throw_exception( sprintf (
- "No suitable BEFORE INSERT triggers found for column %s.%s. "
+ "No suitable BEFORE INSERT triggers found for column '%s.%s'. "
. "You need to specify the correct 'sequence' explicitly in '%s's column_info.",
$source_name,
$col,
my ($final_sql, @final_binds);
if ($op eq 'update') {
- $self->throw_exception('Update with complex WHERE clauses currently not supported')
+ $self->throw_exception('Update with complex WHERE clauses involving BLOB columns currently not supported')
if $sql =~ /\bWHERE\b .+ \bWHERE\b/xs;
my $where_sql;
for my $col (@cols) {
my $seq = ( $col_info->{$col}{sequence} ||= $self->dbh_do('_dbh_get_autoinc_seq', $source, $col) )
or $self->throw_exception( sprintf(
- 'could not determine sequence for column %s.%s, please consider adding a schema-qualified sequence to its column info',
+ "Could not determine sequence for column '%s.%s', please consider adding a schema-qualified sequence to its column info",
$source->name,
$col,
));
$seq_expr = '' unless defined $seq_expr;
$schema = "$schema." if defined $schema && length $schema;
$self->throw_exception( sprintf (
- 'no sequence found for %s%s.%s, check the RDBMS table definition or explicitly set the '.
+ "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,
for my $method (@{$method_dispatch->{unimplemented}}) {
__PACKAGE__->meta->add_method($method, sub {
my $self = shift;
- $self->throw_exception("$method must not be called on ".(blessed $self).' objects');
+ $self->throw_exception("$method() must not be called on ".(blessed $self).' objects');
});
}
} elsif(my $replicant = $self->pool->replicants->{$forced_pool}) {
return $replicant;
} else {
- $self->master->throw_exception("$forced_pool is not a named replicant.");
+ $self->master->throw_exception("'$forced_pool' is not a named replicant.");
}
}
if (not defined $guid_method) {
$self->throw_exception(
- 'You must set new_guid on your storage. See perldoc '
+ 'You must set new_guid() on your storage. See perldoc '
.'DBIx::Class::Storage::DBI::UniqueIdentifier'
);
}
});
$guard->commit;
- } qr/No such column made_up_column .*? at .*?\Q$fn\E line \d+/s, "Error propogated okay";
+ } qr/No such column 'made_up_column' .*? at .*?\Q$fn\E line \d+/s, "Error propogated okay";
ok(!$artist_rs->find({name => 'Death Cab for Cutie'}), "Artist not created");