| 1 | package DBIx::Class::Async::Exception::NotInStorage; | ||
| 2 | |||
| 3 | 102 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 102 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 102 | ▶ | use version; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 102 | our $VERSION = qv('v1.2.0'); | |
| 8 | 102 | our $AUTHORITY = 'cpan:MANWAR'; | |
| 9 | |||
| 10 | 102 | ▶ | use parent 'DBIx::Class::Async::Exception'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | DBIx::Class::Async::Exception::NotInStorage - Exception for operations on | ||
| 15 | un-inserted row objects | ||
| 16 | |||
| 17 | =head1 VERSION | ||
| 18 | |||
| 19 | Version v1.2.0 | ||
| 20 | |||
| 21 | =head1 SYNOPSIS | ||
| 22 | |||
| 23 | use DBIx::Class::Async::Exception::NotInStorage; | ||
| 24 | |||
| 25 | DBIx::Class::Async::Exception::NotInStorage->throw( | ||
| 26 | message => "[DBIx::Class::Async] Cannot update a row that has not been inserted", | ||
| 27 | row_class => 'My::Schema::Result::Operation', | ||
| 28 | operation => 'update', | ||
| 29 | hint => "Call insert() or create() before calling update().", | ||
| 30 | ); | ||
| 31 | |||
| 32 | use Try::Tiny; | ||
| 33 | try { ... } catch { | ||
| 34 | if ( ref $_ && $_->isa('DBIx::Class::Async::Exception::NotInStorage') ) { | ||
| 35 | warn "Row not saved yet (" . $_->row_class . "): " . $_->hint; | ||
| 36 | } | ||
| 37 | }; | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | Thrown when C<update()> or C<delete()> is called on a L<DBIx::Class::Row> | ||
| 42 | object whose C<in_storage> flag is false - meaning the row has not yet been | ||
| 43 | inserted into the database. | ||
| 44 | |||
| 45 | Inherits all methods from L<DBIx::Class::Async::Exception> and adds | ||
| 46 | L</row_class>. | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | 2 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 51 | 2 | my ($class, %args) = @_; | |
| 52 | 2 | my $self = $class->SUPER::new(%args); | |
| 53 | 2 | $self->{row_class} = $args{row_class}; | |
| 54 | 2 | return $self; | |
| 55 | } | ||
| 56 | |||
| 57 | =head1 METHODS | ||
| 58 | |||
| 59 | Inherits C<throw>, C<rethrow>, C<message>, C<hint>, C<original_error>, | ||
| 60 | C<operation>, C<source_class>, and C<stacktrace> from | ||
| 61 | L<DBIx::Class::Async::Exception>. | ||
| 62 | |||
| 63 | =head2 row_class | ||
| 64 | |||
| 65 | my $class = $exception->row_class; | ||
| 66 | |||
| 67 | The fully-qualified result class of the row object that was not in storage, | ||
| 68 | e.g. C<'My::Schema::Result::Operation'>. May be undef if not determinable. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 1 | ▶ | sub row_class { $_[0]->{row_class} } |
|
Subroutine
row_class: called CC=1 SCAR=0.0
Pod
documented
| |||
| 73 | |||
| 74 | =head1 SEE ALSO | ||
| 75 | |||
| 76 | L<DBIx::Class::Async::Exception>, L<DBIx::Class::Async::Exception::Factory> | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Mohammad Sajid Anwar, C<< <mohammad.anwar at yahoo.com> >> | ||
| 81 | |||
| 82 | =head1 REPOSITORY | ||
| 83 | |||
| 84 | L<https://github.com/manwar/DBIx-Class-Async> | ||
| 85 | |||
| 86 | =head1 BUGS | ||
| 87 | |||
| 88 | Please report any bugs or feature requests through the web interface at L<https://github.com/manwar/DBIx-Class-Async/issues>. | ||
| 89 | I will be notified and then you'll automatically be notified of progress on your | ||
| 90 | bug as I make changes. | ||
| 91 | |||
| 92 | =head1 SUPPORT | ||
| 93 | |||
| 94 | You can find documentation for this module with the perldoc command. | ||
| 95 | |||
| 96 | perldoc DBIx::Class::Async::Exception::NotInStorage | ||
| 97 | |||
| 98 | You can also look for information at: | ||
| 99 | |||
| 100 | =over 4 | ||
| 101 | |||
| 102 | =item * BUG Report | ||
| 103 | |||
| 104 | L<https://github.com/manwar/DBIx-Class-Async/issues> | ||
| 105 | |||
| 106 | =item * CPAN Ratings | ||
| 107 | |||
| 108 | L<http://cpanratings.perl.org/d/DBIx-Class-Async> | ||
| 109 | |||
| 110 | =item * Search MetaCPAN | ||
| 111 | |||
| 112 | L<https://metacpan.org/dist/DBIx-Class-Async/> | ||
| 113 | |||
| 114 | =back | ||
| 115 | |||
| 116 | =head1 LICENSE AND COPYRIGHT | ||
| 117 | |||
| 118 | Copyright (C) 2026 Mohammad Sajid Anwar. | ||
| 119 | |||
| 120 | This program is free software; you can redistribute it and / or modify it under | ||
| 121 | the terms of the the Artistic License (2.0). You may obtain a copy of the full | ||
| 122 | license at: | ||
| 123 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 124 | Any use, modification, and distribution of the Standard or Modified Versions is | ||
| 125 | governed by this Artistic License.By using, modifying or distributing the Package, | ||
| 126 | you accept this license. Do not use, modify, or distribute the Package, if you do | ||
| 127 | not accept this license. | ||
| 128 | If your Modified Version has been derived from a Modified Version made by someone | ||
| 129 | other than you,you are nevertheless required to ensure that your Modified Version | ||
| 130 | complies with the requirements of this license. | ||
| 131 | This license does not grant you the right to use any trademark, service mark, | ||
| 132 | tradename, or logo of the Copyright Holder. | ||
| 133 | This license includes the non-exclusive, worldwide, free-of-charge patent license | ||
| 134 | to make, have made, use, offer to sell, sell, import and otherwise transfer the | ||
| 135 | Package with respect to any patent claims licensable by the Copyright Holder that | ||
| 136 | are necessarily infringed by the Package. If you institute patent litigation | ||
| 137 | (including a cross-claim or counterclaim) against any party alleging that the | ||
| 138 | Package constitutes direct or contributory patent infringement,then this Artistic | ||
| 139 | License to you shall terminate on the date that such litigation is filed. | ||
| 140 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND | ||
| 141 | CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED | ||
| 142 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | ||
| 143 | NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS | ||
| 144 | REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, | ||
| 145 | INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE | ||
| 146 | OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | 102 | 1; # End of DBIx::Class::Async::Exception::NotInStorage | |