YAML/Error.pm

filter: Statementstmt 90.3% 28 / 31 Branchbran 87.5% 7 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 0.0% 0 / 2 totaltotal 80.4% 37 / 46 CC 5 SCAR 12.1
CC
5
Cov
90%
format_message
5.0
error_messages
2.0
__ANON__
1.1
CRAP 3.4
« YAML/Mo.pm ↑ Summary YAML/Any.pm »
1 package YAML::Error;
2  
3 4 ▶use YAML::Mo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 has 'code';
6 0 ▶has 'type' => default => sub {'Error'};
Subroutine __ANON__: not called CC=1 SCAR=1.2
7 4 has 'line';
8 4 has 'document';
9 0 ▶has 'arguments' => default => sub {[]};
Subroutine __ANON__: not called CC=1 SCAR=1.2
10  
11 4 my ($error_messages, %line_adjust);
12  
13 46 ▶sub format_message {
Subroutine format_message: called CC=5 SCAR=16.1
Pod undocumented
14 46 my $self = shift;
15 46 my $output = 'YAML ' . $self->type . ': ';
16 46 my $code = $self->code;
17 46 ▶ if ($error_messages->{$code}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error_messages->{$code}) 44 2 46
18 44 $code = sprintf($error_messages->{$code}, @{$self->arguments});
19 }
20 46 $output .= $code . "\n";
21  
22 46 ▶ $output .= ' Code: ' . $self->code . "\n"
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->code 46 0 46
23 if defined $self->code;
24 46 ▶ $output .= ' Line: ' . $self->line . "\n"
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->line 41 5 46
25 if defined $self->line;
26 46 ▶ $output .= ' Document: ' . $self->document . "\n"
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->document 44 2 46
27 if defined $self->document;
28 46 return $output;
29 }
30  
31 0 ▶sub error_messages {
Subroutine error_messages: not called CC=1 SCAR=6.9
Pod undocumented
32 0 $error_messages;
33 }
34  
35 4 %$error_messages = map {s/^\s+//;s/\\n/\n/;$_} split "\n", <<'...';
36 YAML_PARSE_ERR_BAD_CHARS
37 Invalid characters in stream. This parser only supports printable ASCII
38 YAML_PARSE_ERR_BAD_MAJOR_VERSION
39 Can't parse a %s document with a 1.0 parser
40 YAML_PARSE_WARN_BAD_MINOR_VERSION
41 Parsing a %s document with a 1.0 parser
42 YAML_PARSE_WARN_MULTIPLE_DIRECTIVES
43 '%s directive used more than once'
44 YAML_PARSE_ERR_TEXT_AFTER_INDICATOR
45 No text allowed after indicator
46 YAML_PARSE_ERR_NO_ANCHOR
47 No anchor for alias '*%s'
48 YAML_PARSE_ERR_NO_SEPARATOR
49 Expected separator '---'
50 YAML_PARSE_ERR_SINGLE_LINE
51 Couldn't parse single line value
52 YAML_PARSE_ERR_BAD_ANCHOR
53 Invalid anchor
54 YAML_DUMP_ERR_INVALID_INDENT
55 Invalid Indent width specified: '%s'
56 YAML_LOAD_USAGE
57 usage: YAML::Load($yaml_stream_scalar)
58 YAML_PARSE_ERR_BAD_NODE
59 Can't parse node
60 YAML_PARSE_ERR_BAD_EXPLICIT
61 Unsupported explicit transfer: '%s'
62 YAML_DUMP_USAGE_DUMPCODE
63 Invalid value for DumpCode: '%s'
64 YAML_LOAD_ERR_FILE_INPUT
65 Couldn't open %s for input:\n%s
66 YAML_DUMP_ERR_FILE_CONCATENATE
67 Can't concatenate to YAML file %s
68 YAML_DUMP_ERR_FILE_OUTPUT
69 Couldn't open %s for output:\n%s
70 YAML_DUMP_ERR_FILE_OUTPUT_CLOSE
71 Error closing %s:\n%s
72 YAML_DUMP_ERR_NO_HEADER
73 With UseHeader=0, the node must be a plain hash or array
74 YAML_DUMP_WARN_BAD_NODE_TYPE
75 Can't perform serialization for node type: '%s'
76 YAML_EMIT_WARN_KEYS
77 Encountered a problem with 'keys':\n%s
78 YAML_DUMP_WARN_DEPARSE_FAILED
79 Deparse failed for CODE reference
80 YAML_DUMP_WARN_CODE_DUMMY
81 Emitting dummy subroutine for CODE reference
82 YAML_PARSE_ERR_MANY_EXPLICIT
83 More than one explicit transfer
84 YAML_PARSE_ERR_MANY_IMPLICIT
85 More than one implicit request
86 YAML_PARSE_ERR_MANY_ANCHOR
87 More than one anchor
88 YAML_PARSE_ERR_ANCHOR_ALIAS
89 Can't define both an anchor and an alias
90 YAML_PARSE_ERR_BAD_ALIAS
91 Invalid alias
92 YAML_PARSE_ERR_MANY_ALIAS
93 More than one alias
94 YAML_LOAD_ERR_NO_CONVERT
95 Can't convert implicit '%s' node to explicit '%s' node
96 YAML_LOAD_ERR_NO_DEFAULT_VALUE
97 No default value for '%s' explicit transfer
98 YAML_LOAD_ERR_NON_EMPTY_STRING
99 Only the empty string can be converted to a '%s'
100 YAML_LOAD_ERR_BAD_MAP_TO_SEQ
101 Can't transfer map as sequence. Non numeric key '%s' encountered.
102 YAML_DUMP_ERR_BAD_GLOB
103 '%s' is an invalid value for Perl glob
104 YAML_DUMP_ERR_BAD_REGEXP
105 '%s' is an invalid value for Perl Regexp
106 YAML_LOAD_ERR_BAD_MAP_ELEMENT
107 Invalid element in map
108 YAML_LOAD_WARN_DUPLICATE_KEY
109 Duplicate map key '%s' found. Ignoring.
110 YAML_LOAD_ERR_BAD_SEQ_ELEMENT
111 Invalid element in sequence
112 YAML_PARSE_ERR_INLINE_MAP
113 Can't parse inline map
114 YAML_PARSE_ERR_INLINE_SEQUENCE
115 Can't parse inline sequence
116 YAML_PARSE_ERR_BAD_DOUBLE
117 Can't parse double quoted string
118 YAML_PARSE_ERR_BAD_SINGLE
119 Can't parse single quoted string
120 YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
121 Can't parse inline implicit value '%s'
122 YAML_PARSE_ERR_BAD_IMPLICIT
123 Unrecognized implicit value '%s'
124 YAML_PARSE_ERR_INDENTATION
125 Error. Invalid indentation level
126 YAML_PARSE_ERR_INCONSISTENT_INDENTATION
127 Inconsistent indentation level
128 YAML_LOAD_WARN_UNRESOLVED_ALIAS
129 Can't resolve alias *%s
130 YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP
131 No 'REGEXP' element for Perl regexp
132 YAML_LOAD_WARN_BAD_REGEXP_ELEM
133 Unknown element '%s' in Perl regexp
134 YAML_LOAD_WARN_GLOB_NAME
135 No 'NAME' element for Perl glob
136 YAML_LOAD_WARN_PARSE_CODE
137 Couldn't parse Perl code scalar: %s
138 YAML_LOAD_WARN_CODE_DEPARSE
139 Won't parse Perl code unless $YAML::LoadCode is set
140 YAML_EMIT_ERR_BAD_LEVEL
141 Internal Error: Bad level detected
142 YAML_PARSE_WARN_AMBIGUOUS_TAB
143 Amibiguous tab converted to spaces
144 YAML_LOAD_WARN_BAD_GLOB_ELEM
145 Unknown element '%s' in Perl glob
146 YAML_PARSE_ERR_ZERO_INDENT
147 Can't use zero as an indentation width
148 YAML_LOAD_WARN_GLOB_IO
149 Can't load an IO filehandle. Yet!!!
150 ...
151  
152 4 %line_adjust = map {($_, 1)}
153 qw(YAML_PARSE_ERR_BAD_MAJOR_VERSION
154 YAML_PARSE_WARN_BAD_MINOR_VERSION
155 YAML_PARSE_ERR_TEXT_AFTER_INDICATOR
156 YAML_PARSE_ERR_NO_ANCHOR
157 YAML_PARSE_ERR_MANY_EXPLICIT
158 YAML_PARSE_ERR_MANY_IMPLICIT
159 YAML_PARSE_ERR_MANY_ANCHOR
160 YAML_PARSE_ERR_ANCHOR_ALIAS
161 YAML_PARSE_ERR_BAD_ALIAS
162 YAML_PARSE_ERR_MANY_ALIAS
163 YAML_LOAD_ERR_NO_CONVERT
164 YAML_LOAD_ERR_NO_DEFAULT_VALUE
165 YAML_LOAD_ERR_NON_EMPTY_STRING
166 YAML_LOAD_ERR_BAD_MAP_TO_SEQ
167 YAML_LOAD_ERR_BAD_STR_TO_INT
168 YAML_LOAD_ERR_BAD_STR_TO_DATE
169 YAML_LOAD_ERR_BAD_STR_TO_TIME
170 YAML_LOAD_WARN_DUPLICATE_KEY
171 YAML_PARSE_ERR_INLINE_MAP
172 YAML_PARSE_ERR_INLINE_SEQUENCE
173 YAML_PARSE_ERR_BAD_DOUBLE
174 YAML_PARSE_ERR_BAD_SINGLE
175 YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
176 YAML_PARSE_ERR_BAD_IMPLICIT
177 YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP
178 YAML_LOAD_WARN_BAD_REGEXP_ELEM
179 YAML_LOAD_WARN_REGEXP_CREATE
180 YAML_LOAD_WARN_GLOB_NAME
181 YAML_LOAD_WARN_PARSE_CODE
182 YAML_LOAD_WARN_CODE_DEPARSE
183 YAML_LOAD_WARN_BAD_GLOB_ELEM
184 YAML_PARSE_ERR_ZERO_INDENT
185 );
186  
187 package YAML::Warning;
188  
189 4 our @ISA = 'YAML::Error';
190  
191 4 1;
« YAML/Mo.pm ↑ Summary YAML/Any.pm »