Throw(label, error)
Marks an expected error branch in the catalog, emits an ERROR_THROWN inspector event with layer: 'expected', then rethrows the same Error instance. Your callers still see a thrown exception.
import { Cat, Throw } from '@gloocan/cat-inspector'
class AuthService {
@Cat
async login(email: string, password: string) {
const user = await this.users.find(email)
if (!user) Throw('USER_NOT_FOUND', new Error('unknown email'))
// …
}
}Signature
function Throw<L extends string>(label: L, error: Error): neverThe label must match a pre-declared error slot on the RegistryEntry (populated from the function body at registration time alongside @Cat / cat).
Uncaught errors
Errors that are not passed through Throw may still be reported as ERROR_THROWN with layer: 'unexpected' when they escape the wrapper.