panicregister

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package panicregister provides the only approved way to panic in GoCell production code. All production panic() call sites must wrap their payload with Approved, passing a kebab-case reason literal that documents the ADR-approved rationale. This creates a single typed funnel that archtest PANIC-REGISTERED-01 can statically verify: any bare panic(), or any panic() whose argument is not a direct call to panicregister.Approved, is rejected. See .claude/rules/gocell/error-handling.md for the A/B/C classification policy and the list of approved sites.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Approved

func Approved(reason string, value any) any

Approved tags a production panic call site as ADR-approved.

reason MUST be a const string literal (kebab-case identifier like "lifecycle-recover-rethrow-to-recovery-middleware"). archtest PANIC-REGISTERED-01 rejects non-literal forms (fmt.Sprintf, concatenation, variables).

value is the panic payload — typically:

  • *errcode.Error from errcode.Assertion(...) for state-machine / programmer-error sites
  • the original value recovered from a defer for framework re-throw sites

Approved returns value unchanged, so recover() upstack observes the same value it would observe from a bare panic(value). The function is purely a source-level marker; the archtest enforces that every production panic() call site has the form panic(panicregister.Approved(literal, _)).

Hard funnel rationale: this is the unique panic-approved entry point in GoCell production code. Using any other shape — bare panic, different callee, non-literal reason — fails archtest PANIC-REGISTERED-01. See .claude/rules/gocell/ai-robust.md "Hard 范本" and charter §4 Wave 2.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL