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