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 / sec-default / hooks / caught / provided-caught.ts
19 lines · 696 BRaw
1import { pastUsers } from '../past-users'
2import type PastUsers from '../past-users'
3import type Types from './types'
4
5/**
6 * The failure handler of a hook that lets an organization's subject
7 * continue past the user tier: the hook's own decision, made again.
8 *
9 * Where the failed hook had already continued, that call's answer comes
10 * back in its place. It reads the subject's pinned provider alone.
11 *
12 * @param e the event's input with its pinned `provider`
13 * @param next the handler's continuation
14 * @returns the hook's answer
15 */
16export const providedCaught = <E extends PastUsers.Provided, R>(
17 e: E,
18 next: Types.CaughtNext<E, R>,
19) => (next.called ? next(e) : pastUsers(e, next))