@@ -7,6 +7,7 @@ import { MetricType } from "../index.js";
77import { generateUUIDv4 , isString } from "../../utils.js" ;
88import { Context } from "../../context.js" ;
99import { Metric } from "../metric.js" ;
10+ import { ErrorType , recordError , testGetNumRecordedErrors } from "../../error_recording.js" ;
1011
1112// Loose UUID regex for checking if a string has a UUID _shape_. Does not contain version checks.
1213//
@@ -67,8 +68,11 @@ class UUIDMetricType extends MetricType {
6768 try {
6869 metric = new UUIDMetric ( value ) ;
6970 } catch {
70- // TODO: record error once Bug 1682574 is resolved.
71- console . warn ( `"${ value } " is not a valid UUID. Ignoring` ) ;
71+ await recordError (
72+ instance ,
73+ ErrorType . InvalidValue ,
74+ `"${ value } " is not a valid UUID.`
75+ ) ;
7276 return ;
7377 }
7478
@@ -123,6 +127,19 @@ class UUIDMetricType extends MetricType {
123127 } ) ;
124128 return metric ;
125129 }
130+
131+ /**
132+ * Returns the number of errors recorded for the given metric.
133+ *
134+ * @param errorType The type of the error recorded.
135+ * @param pingName represents the name of the ping to retrieve the metric for.
136+ * Defaults to the first value in `sendInPings`.
137+ *
138+ * @return the number of errors recorded for the metric.
139+ */
140+ async testGetNumRecordedErrors ( errorType : string , ping : string = this . sendInPings [ 0 ] ) : Promise < number > {
141+ return testGetNumRecordedErrors ( this , errorType as ErrorType , ping ) ;
142+ }
126143}
127144
128145export default UUIDMetricType ;
0 commit comments