Async/Exception/MissingColumn.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 96.4% 27 / 28 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Async/Exception/AmbiguousColumn.pm ↑ Summary Async/Exception/NoSuchRelationship.pm »
1 package DBIx::Class::Async::Exception::MissingColumn;
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::MissingColumn - Exception for absent required
15 columns on insert
16  
17 =head1 VERSION
18  
19 Version v1.2.0
20  
21 =head1 SYNOPSIS
22  
23 use DBIx::Class::Async::Exception::MissingColumn;
24  
25 DBIx::Class::Async::Exception::MissingColumn->throw(
26 message => "[DBIx::Class::Async] Required column 'opdate' was not provided",
27 column => 'opdate',
28 source_class => 'My::Schema::Result::Operation',
29 operation => 'create',
30 hint => "Add 'opdate' to your insert/create hashref.",
31 );
32  
33 use Try::Tiny;
34 try { ... } catch {
35 if ( ref $_ && $_->isa('DBIx::Class::Async::Exception::MissingColumn') ) {
36 warn "Missing column '" . $_->column . "': " . $_->hint;
37 }
38 };
39  
40 =head1 DESCRIPTION
41  
42 Thrown when a column declared as NOT NULL with no default value is absent from
43 a create or insert hashref, causing the database or L<DBIx::Class> to reject
44 the operation.
45  
46 Inherits all methods from L<DBIx::Class::Async::Exception> and adds
47 L</column>.
48  
49 =cut
50  
51 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
52 1 my ($class, %args) = @_;
53 1 my $self = $class->SUPER::new(%args);
54 1 $self->{column} = $args{column};
55 1 return $self;
56 }
57  
58 =head1 METHODS
59  
60 Inherits C<throw>, C<rethrow>, C<message>, C<hint>, C<original_error>,
61 C<operation>, C<source_class>, and C<stacktrace> from
62 L<DBIx::Class::Async::Exception>.
63  
64 =head2 column
65  
66 my $col = $exception->column;
67  
68 The name of the required column that was not provided, e.g. C<'opdate'>.
69  
70 =cut
71  
72 1 ▶sub column { $_[0]->{column} }
Subroutine column: 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::MissingColumn
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::MissingColumn
« Async/Exception/AmbiguousColumn.pm ↑ Summary Async/Exception/NoSuchRelationship.pm »