| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/Exception.pm | ||||||||||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||
| 6 | ## Created 2021/11/27 | ||||||||||||||||||||
| 7 | ## Modified 2022/09/18 | ||||||||||||||||||||
| 8 | ## All rights reserved | ||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||
| 10 | ## | ||||||||||||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||
| 12 | ## under the same terms as Perl itself. | ||||||||||||||||||||
| 13 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||
| 14 | package HTML::Object::Exception; | ||||||||||||||||||||
| 15 | BEGIN | ||||||||||||||||||||
| 16 | { | ||||||||||||||||||||
| 17 | 33 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 33 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 33 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 33 | ▶ | use parent qw( Module::Generic::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 33 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 33 | our $VERSION = 'v0.2.0'; | |||||||||||||||||||
| 23 | }; | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 33 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 26 | 33 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | ▶ | sub columnNumber { return( shift->_set_get_number( 'column', @_ ) ); } | ||||||||||||||||||
|
Subroutine
columnNumber: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | ▶ | sub colno { return( shift->columnNumber( @_ ) ); } | ||||||||||||||||||
|
Subroutine
colno: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 0 | ▶ | sub fileName { return( shift->file( @_ ) ); } | ||||||||||||||||||
|
Subroutine
fileName: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 0 | ▶ | sub filename { return( shift->file( @_ ) ); } | ||||||||||||||||||
|
Subroutine
filename: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 0 | ▶ | sub lineNumber { return( shift->line( @_ ) ); } | ||||||||||||||||||
|
Subroutine
lineNumber: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | sub lineno { return( shift->line( @_ ) ); } | ||||||||||||||||||
|
Subroutine
lineno: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | ▶ | sub name { return( ref( $_[0] ) || $_[0] ); } | ||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/3
ref $_[0] || $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
Truth table0%0/3
A || B
A= ref $_[0]B= $_[0]
| |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | sub stack { return( shift->trace ); } | ||||||||||||||||||
|
Subroutine
stack: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | ▶ | sub toLocalString { return( shift->as_string ); } | ||||||||||||||||||
|
Subroutine
toLocalString: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub toString { return( shift->as_string ); } | ||||||||||||||||||
|
Subroutine
toString: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | { | ||||||||||||||||||||
| 49 | package | ||||||||||||||||||||
| 50 | HTML::Object::HierarchyRequestError; | ||||||||||||||||||||
| 51 | BEGIN | ||||||||||||||||||||
| 52 | { | ||||||||||||||||||||
| 53 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | package HTML::Object::IndexSizeError; | ||||||||||||||||||||
| 57 | BEGIN | ||||||||||||||||||||
| 58 | { | ||||||||||||||||||||
| 59 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 60 | }; | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | package | ||||||||||||||||||||
| 63 | HTML::Object::InvalidCharacterError; | ||||||||||||||||||||
| 64 | BEGIN | ||||||||||||||||||||
| 65 | { | ||||||||||||||||||||
| 66 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 67 | }; | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | package | ||||||||||||||||||||
| 70 | HTML::Object::InvalidStateError; | ||||||||||||||||||||
| 71 | BEGIN | ||||||||||||||||||||
| 72 | { | ||||||||||||||||||||
| 73 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 74 | }; | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | package HTML::Object::MediaError; | ||||||||||||||||||||
| 77 | BEGIN | ||||||||||||||||||||
| 78 | { | ||||||||||||||||||||
| 79 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 80 | }; | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | package HTML::Object::NotFoundError; | ||||||||||||||||||||
| 83 | BEGIN | ||||||||||||||||||||
| 84 | { | ||||||||||||||||||||
| 85 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 86 | }; | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | package | ||||||||||||||||||||
| 89 | HTML::Object::SyntaxError; | ||||||||||||||||||||
| 90 | BEGIN | ||||||||||||||||||||
| 91 | { | ||||||||||||||||||||
| 92 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 93 | }; | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | package | ||||||||||||||||||||
| 96 | HTML::Object::TypeError; | ||||||||||||||||||||
| 97 | BEGIN | ||||||||||||||||||||
| 98 | { | ||||||||||||||||||||
| 99 | 33 | ▶ | use parent -norequire, qw( HTML::Object::Exception ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 100 | }; | ||||||||||||||||||||
| 101 | } | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | 33 | 1; | |||||||||||||||||||
| 104 | # NOTE: POD | ||||||||||||||||||||
| 105 | __END__ | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | =encoding utf-8 | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | =head1 NAME | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | HTML::Object::Exception - HTML Object | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | =head1 SYNOPSIS | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | use HTML::Object::Exception; | ||||||||||||||||||||
| 116 | my $this = HTML::Object::Exception->new || | ||||||||||||||||||||
| 117 | die( HTML::Object::Exception->error, "\n" ); | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | =head1 VERSION | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | v0.2.0 | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | =head1 DESCRIPTION | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | This class inherits all its features and methods from L<Module::Generic::Exception>, and implements the following additional methods: | ||||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | =head1 METHODS | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | =head2 colno | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | An alias for L</columnNumber> | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | =head2 columnNumber | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | Returns the column number, which usually returns C<undef>, because this is not set. | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | =head2 fileName | ||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | The file name where the error occurred. This is an alias for L<Module::Generic::Exception/file> | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | =head2 filename | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | An alias for L</fileName> | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | =head2 lineno | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | =head2 lineNumber | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | The line number where the error occurred. This is an alias for L<Module::Generic::Exception/line> | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | =head2 name | ||||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | Returns the class name. For example: C<HTML::Object::Exception> | ||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | =head2 stack | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | Returns the stack trace object. This is an alias for L<Module::Generic::Exception/trace> | ||||||||||||||||||||
| 158 | |||||||||||||||||||||
| 159 | =head2 toLocalString | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | This is an alias for L<Module::Generic::Exception/as_string> | ||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | =head2 toString | ||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | This is an alias for L<Module::Generic::Exception/as_string> | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | =head2 OTHER EXCEPTION CLASSES | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | This module also implements the following exception classes used predominantly by L<HTML::Object::DOM> | ||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | =over 4 | ||||||||||||||||||||
| 172 | |||||||||||||||||||||
| 173 | =item HTML::Object::ErrorEvent | ||||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | The L<HTML::Object::ErrorEvent> object represents an error triggered and captured by a global error in the L<HTML::Object::DOM::Document> object. | ||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | It is used by properties like L<HTML::Object::DOM::Document/onabort> or L<HTML::Object::DOM::Document/onerror> | ||||||||||||||||||||
| 178 | |||||||||||||||||||||
| 179 | See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent> | ||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | =item HTML::Object::HierarchyRequestError | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | The C<HTML::Object::HierarchyRequestError> object represents an error when the node tree hierarchy is not correct. | ||||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | =item HTML::Object::IndexSizeError | ||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | The C<HTML::Object::IndexSizeError> object representations an error that occurs when an index is not in the allowed range. | ||||||||||||||||||||
| 188 | |||||||||||||||||||||
| 189 | For example, in L<HTML::Object::DOM::CharacterData/substringData> | ||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | =item HTML::Object::InvalidCharacterError | ||||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | The C<HTML::Object::InvalidCharacterError> object represents an error when a given named parameter contains one or more characters which are not valid. | ||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | =item HTML::Object::InvalidStateError | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | The C<HTML::Object::InvalidStateError> object represents an error when there is in an invalid state. | ||||||||||||||||||||
| 198 | |||||||||||||||||||||
| 199 | =item HTML::Object::MediaError | ||||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | The C<HTML::Object::MediaError> object represents a L<HTML::Object::DOM::Element::Media> error. | ||||||||||||||||||||
| 202 | |||||||||||||||||||||
| 203 | =item HTML::Object::NotFoundError | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | The C<HTML::Object::NotFoundError> object represents an error when the object cannot be found here. | ||||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | =item HTML::Object::SyntaxError | ||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | The C<HTML::Object::SyntaxError> object represents an error when trying to interpret syntactically invalid code. | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | =item HTML::Object::TypeError | ||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | The C<HTML::Object::TypeError> object represents an error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. | ||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | =back | ||||||||||||||||||||
| 216 | |||||||||||||||||||||
| 217 | =head1 AUTHOR | ||||||||||||||||||||
| 218 | |||||||||||||||||||||
| 219 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||||||||||||||||||||
| 220 | |||||||||||||||||||||
| 221 | =head1 SEE ALSO | ||||||||||||||||||||
| 222 | |||||||||||||||||||||
| 223 | L<HTML::Object::HierarchyRequestError>, L<Module::Generic::Exception>, L<Module::Generic/error> | ||||||||||||||||||||
| 224 | |||||||||||||||||||||
| 225 | L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/DOMException> | ||||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | L<HTML::Object>, L<HTML::Object::Attribute>, L<HTML::Object::Boolean>, L<HTML::Object::Closing>, L<HTML::Object::Collection>, L<HTML::Object::Comment>, L<HTML::Object::Declaration>, L<HTML::Object::Document>, L<HTML::Object::Element>, L<HTML::Object::Exception>, L<HTML::Object::Literal>, L<HTML::Object::Number>, L<HTML::Object::Root>, L<HTML::Object::Space>, L<HTML::Object::Text>, L<HTML::Object::XQuery> | ||||||||||||||||||||
| 228 | |||||||||||||||||||||
| 229 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||
| 230 | |||||||||||||||||||||
| 231 | Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | All rights reserved | ||||||||||||||||||||
| 234 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||
| 235 | |||||||||||||||||||||
| 236 | =cut | ||||||||||||||||||||