MCPcopy Create free account
hub / github.com/ampproject/amphtml / ValidationError

Function ValidationError

validator/js/nodejs/index.js:149–197  ·  view source on GitHub ↗

* Each validation error describes a specific problem in a validated * document. This class corresponds to the ValidationError message in * validator.proto in this directory. * @export * @constructor

()

Source from the content-addressed store, hash-verified

147 * @constructor
148 */
149function ValidationError() {
150 /**
151 * The severity of the error - possible values are 'UNKNOWN_SEVERITY',
152 * 'ERROR', and 'WARNING'.
153 */
154 this.severity = 'UNKNOWN_SEVERITY';
155 /**
156 * The line number at which the error was seen (1 is the first line).
157 */
158 this.line = 1;
159 /**
160 * The column number at which the error was seen (0 is the first column).
161 */
162 this.col = 0;
163 /**
164 * A human-readable error message for the validation error.
165 * If you find yourself trying to write a parser against this string
166 * to scrape out some detail, consider looking at the code and params
167 * fields below.
168 * @type {string}
169 */
170 this.message = '';
171 /**
172 * The spec URL is often added by the validator to provide additional
173 * context for the error. In a user interface this would be shown
174 * as a "Learn more" link.
175 * @type {string}
176 */
177 this.specUrl = null;
178 /**
179 * This field is only useful when scripting against the validator,
180 * it should not be displayed in a user interface as it adds nothing
181 * for humans to read over the message field (see above).
182 * Possible values are the codes listed in ValidationError.Code - see
183 * validator.proto. Examples: 'UNKNOWN_CODE', 'MANDATORY_TAG_MISSING',
184 * 'TAG_REQUIRED_BY_MISSING'. For each of these codes there is a
185 * format string in validator-main.protoascii (look for error_formats),
186 * which is used to assemble the message from the strings in params.
187 * @type {string}
188 */
189 this.code = 'UNKNOWN_CODE';
190 /**
191 * This field is only useful when scripting against the validator,
192 * it should not be displayed in a user interface as it adds nothing
193 * for humans to read over the message field (see above).
194 * @type {!Array<string>}
195 */
196 this.params = [];
197}
198
199/**
200 * The validator instance is a proxy object to a precompiled

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected