spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / telemetry / hooks / entries / refusal / refusal.ts
17 lines · 676 BRaw
1import type { Method } from '../method'
2import type { RefusedEntry } from '../refused-entry'
3
4/**
5 * The error a refused entry rejects with, naming the method and what was
6 * wrong, the reason kept beside the message as `what`.
7 *
8 * The text carries a key that passed TOKEN or a status code, nothing the caller
9 * wrote as free text.
10 *
11 * @param what the refusal, as the caller reads it
12 * @param method the method refusing
13 * @returns the error to reject the call with, naming the method and what was
14 * wrong
15 */
16export const refusal = (what: string, method: Method = 'log'): RefusedEntry =>
17 Object.assign(new Error(`$.telemetry.${method}: ${what}`), { what })