@@ -46,7 +46,7 @@ export class StringListMetric extends Metric<string[], string[]> {
4646 *
4747 * This allows appending a string value with arbitrary content to a list.
4848 * The list is length-limited to `MAX_LIST_LENGTH`.
49- * Strings are length-limited to `MAX_STRING_LENGTH` bytes .
49+ * Strings are length-limited to `MAX_STRING_LENGTH` characters .
5050 */
5151class StringListMetricType extends MetricType {
5252 constructor ( meta : CommonMetricData ) {
@@ -94,9 +94,9 @@ class StringListMetricType extends MetricType {
9494 *
9595 * # Note
9696 *
97- * - If the list is already of length `MAX_LIST_LENGTH`, log an error.
98- * - Truncates the value if it is longer than `MAX_STRING_LENGTH` bytes
99- * and logs an error.
97+ * - If the list is already of length `MAX_LIST_LENGTH`, record an error.
98+ * - Truncates the value if it is longer than `MAX_STRING_LENGTH` characters
99+ * and records an error.
100100 *
101101 * @param value The string to add.
102102 */
@@ -107,7 +107,7 @@ class StringListMetricType extends MetricType {
107107 }
108108
109109 const truncatedValue = await truncateStringAtBoundaryWithError ( this , value , MAX_STRING_LENGTH ) ;
110- let currentLen = - 1 ;
110+ let currentLen = 0 ;
111111
112112 const transformFn = ( ( value ) => {
113113 return ( v ?: JSONValue ) : StringListMetric => {
@@ -131,7 +131,7 @@ class StringListMetricType extends MetricType {
131131
132132 await Context . metricsDatabase . transform ( this , transformFn ) ;
133133
134- if ( currentLen = = MAX_LIST_LENGTH ) {
134+ if ( currentLen > = MAX_LIST_LENGTH ) {
135135 await Context . errorManager . record (
136136 this ,
137137 ErrorType . InvalidValue ,
0 commit comments