---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [cli](../index.md) / classifyError

# Function: classifyError()

> **classifyError**(`err`): [`ErrorCategory`](../type-aliases/ErrorCategory.md)

Defined in: [packages/b2c-tooling-sdk/src/cli/base-command.ts:79](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/cli/base-command.ts#L79)

Classify a thrown command error for telemetry so analytics can exclude
expected validation/guardrail errors from reliability (defect-rate) metrics.

Resolution order:
1. An explicit oclif `code` of [ERROR\_CODE.VALIDATION](../variables/ERROR_CODE.md#validation) / `GUARDRAIL`
   (set at the throw site via `this.error(msg, {code})`).
2. Safety error class names thrown from HTTP/auth middleware that do not flow
   through `this.error` (`SafetyBlockedError`, `SafetyConfirmationRequired`).
3. Everything else is a genuine `runtime` error (the reliability signal).

## Parameters

### err

`unknown`

## Returns

[`ErrorCategory`](../type-aliases/ErrorCategory.md)
