NAME
DBIx::Class::Async::Exception - Base class for DBIx::Class::Async exceptions
VERSION
Version 0.63
SYNOPSIS
# In application code -- catch any async exception
use Try::Tiny;
try {
$rs->async_update_or_create(\%data)->get;
} catch {
if ( ref $_ && $_->isa('DBIx::Class::Async::Exception::RelationshipAsColumn') ) {
warn "Fix your hashref: " . $_->hint;
}
elsif ( ref $_ && $_->isa('DBIx::Class::Async::Exception') ) {
warn "Async DBIC error: " . $_->message;
warn "Original: " . $_->original_error if $_->original_error;
}
else {
die $_; # re-throw unknown exceptions
}
};
# Load a specific subclass directly when you need to throw or catch it by name
use DBIx::Class::Async::Exception::RelationshipAsColumn;
DBIx::Class::Async::Exception::RelationshipAsColumn->throw(
message => "Relationship 'Details' passed where a column was expected",
relationship => 'Details',
source_class => 'My::Schema::Result::Operation',
operation => 'update_or_create',
hint => "Omit 'Details' from the hashref if you have no related rows.",
);
DESCRIPTION
Base class for all structured exceptions thrown by DBIx::Class::Async. Consistent with the interface of DBIx::Class::Exception: objects stringify to their message, support boolean overload, and provide throw/rethrow.
This module defines only the base class. Each subclass lives in its own file and must be loaded explicitly, or loaded transitively by DBIx::Class::Async::Exception::Factory which loads all subclasses as part of its own initialisation.
In normal use you do not need to load this module directly. Loading DBIx::Class::Async::Exception::Factory in Async.pm is sufficient -- the Factory loads the base class and all subclasses, and is the sole entry point for translating raw DBIx::Class errors into typed exception objects.
Exception hierarchy
DBIx::Class::Async::Exception
+-- DBIx::Class::Async::Exception::RelationshipAsColumn
+-- DBIx::Class::Async::Exception::NotInStorage
+-- DBIx::Class::Async::Exception::MissingColumn
+-- DBIx::Class::Async::Exception::NoSuchRelationship
+-- DBIx::Class::Async::Exception::AmbiguousColumn
METHODS
throw
DBIx::Class::Async::Exception->throw(%args);
DBIx::Class::Async::Exception->throw($exception_object);
Constructs and throws an exception. %args are passed to new(). If a single argument is passed and is already an instance of this class or a subclass, it is re-thrown as-is -- consistent with "throw" in DBIx::Class::Exception.
rethrow
$exception->rethrow;
Re-throws the exception object without modifying it.
message
The human-readable error message. Also what the object stringifies to.
hint
An optional actionable suggestion for how to fix the problem.
original_error
The raw exception string from DBIx::Class, preserved for debugging or logging.
operation
The DBIC operation being performed when the error occurred, e.g. 'update_or_create', 'create', 'find'. May be undef.
source_class
The fully-qualified result class associated with the error, e.g. 'My::Schema::Result::Operation'. May be undef.
stacktrace
Optional stack trace string, populated when stacktrace => 1 is passed to throw or new, mirroring DBIx::Class::Exception behaviour.
stringify
Alias for message. Called automatically by the "" overload.
SUBCLASSES
Each subclass lives in its own file. Load a subclass directly when you need to reference it by name, or use DBIx::Class::Async::Exception::Factory which loads all subclasses as part of its own initialisation.
- DBIx::Class::Async::Exception::RelationshipAsColumn
-
Thrown when a relationship name is passed as a hashref key with an
undefvalue (RT#127065). Adds:relationship,relationship_type. - DBIx::Class::Async::Exception::NotInStorage
-
Thrown when
update()ordelete()is called on an un-inserted row. Adds:row_class. - DBIx::Class::Async::Exception::MissingColumn
-
Thrown when a required column is absent from a create/insert hashref. Adds:
column. - DBIx::Class::Async::Exception::NoSuchRelationship
-
Thrown when a relationship name used in
join/prefetchis not declared. Adds:relationship. - DBIx::Class::Async::Exception::AmbiguousColumn
-
Thrown when a column name is ambiguous across joined tables. Adds:
column.
SEE ALSO
DBIx::Class::Async::Exception::Factory
AUTHOR
Mohammad Sajid Anwar, <mohammad.anwar at yahoo.com>
REPOSITORY
https://github.com/manwar/DBIx-Class-Async
BUGS
Please report any bugs or feature requests through the web interface at https://github.com/manwar/DBIx-Class-Async/issues. I will be notified and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc DBIx::Class::Async::Exception
You can also look for information at:
BUG Report
CPAN Ratings
Search MetaCPAN
LICENSE AND COPYRIGHT
Copyright (C) 2026 Mohammad Sajid Anwar.
This program is free software; you can redistribute it and / or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0 Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License.By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you,you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement,then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.