X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=0395bd753573d60c0aca31581dfa373209d85cb1;hb=613397e734cc6992618e73c5373c3883071fcde5;hp=b1fa17f97da253c94322488cbc72daf7b6812cc3;hpb=a7783df5b755ef1379e91f55974ee86ccc31e0ea;p=dbsrgits%2FDBIx-Class-Historic.git
diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm
index b1fa17f..0395bd7 100644
--- a/lib/DBIx/Class/Schema.pm
+++ b/lib/DBIx/Class/Schema.pm
@@ -15,6 +15,7 @@ __PACKAGE__->mk_classdata('source_registrations' => {});
__PACKAGE__->mk_classdata('storage_type' => '::DBI');
__PACKAGE__->mk_classdata('storage');
__PACKAGE__->mk_classdata('exception_action');
+__PACKAGE__->mk_classdata('stacktrace' => 0);
=head1 NAME
@@ -863,7 +864,7 @@ sub populate {
If C is set for this class/object, L
will prefer to call this code reference with the exception as an argument,
-rather than its normal action.
+rather than its normal C or C action.
Your subroutine should probably just wrap the error in the exception
object/class of your choosing and rethrow. If, against all sage advice,
@@ -885,6 +886,18 @@ Example:
# suppress all exceptions, like a moron:
$schema_obj->exception_action(sub { 1 });
+=head2 stacktrace
+
+=over4
+
+=item Arguments: boolean
+
+=back
+
+This alters the behavior of the default L action. It
+uses C if C is false, or C if C
+is true. The default is false.
+
=head2 throw_exception
=over 4
@@ -895,13 +908,16 @@ Example:
Throws an exception. Defaults to using L to report errors from
user's perspective. See L for details on overriding
-this method's behavior.
+this method's behavior. If L is turned on, C
+will use C instead of C.
=cut
sub throw_exception {
my $self = shift;
- croak @_ if !$self->exception_action || !$self->exception_action->(@_);
+ if(!$self->exception_action || !$self->exception_action->(@_)) {
+ $self->stacktrace ? confess @_ : croak @_;
+ }
}
=head2 deploy (EXPERIMENTAL)