--- title: "userErrorMetricsHandler()" slug: "usererrormetricshandler" updated: 2025-05-01T16:09:31Z published: 2025-05-01T16:09:31Z canonical: "docs.developer.comcast.com/usererrormetricshandler" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # userErrorMetricsHandler() ## userErrorMetricsHandler() Logs a metric indicating that the user initiated action failed. For other errors, see [errorMetricsHandler](/docs/errormetricshandler). #### Signature: `$badger.userErrorMetricsHandler(message, visible, code, args)` #### Parameters: | parameter | description | data type | required? | | --- | --- | --- | --- | | message | The text of the error message | String | Yes | | visible | indicates whether the error was displayed to the user | Boolean | Yes | | code | The error code which was displayed. This can be any value which is meaningful to your app, but defaults to CH_ERR | String | No | | args | Optional arguments to include.The individual properties in args must be primitives (string, numeric or boolean). Nesting of properties is not supported. | Object | No | #### Return Values: None. #### Usage Example: ``` $badger.userErrorMetricsHandler("This is a user error", true, "USER-001", { httpStatusCode: '401', exception: 'Authorized access', responseTimeMs: 476 }); ``` #### Mandatory integration: Must be invoked to support the Error Free Session Rate metric of the [App Requirements](/docs/app-requirements).