Function truncateStringAtBytesBoundaryWithError

  • Truncates a string to a given max number of bytes.

    If the string required truncation, records an error through the error reporting mechanism.

    Parameters

    • metric: MetricType

      The metric to record an error to, if necessary,

    • value: unknown

      The string to truncate.

    • maxBytes: number

      The max number of bytes to truncate to.

    Returns string

    A string with at most maxLength bytes.

    Throws

    In case value is not a string.

Generated using TypeDoc