en un clic
error-handling
Return errors up, no log-and-return, %w wrapping
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Return errors up, no log-and-return, %w wrapping
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
How to write comprehensive architectural proposals that drive alignment before code is written
How the eval engine works: generate → grade → review → report
Record final outcomes to history.md, not intermediate requests or reversed decisions
Tone enforcement patterns for external-facing community responses
Team initialization flow (Phase 1 proposal + Phase 2 creation)
Core conventions and patterns for this codebase
| name | error-handling |
| description | Return errors up, no log-and-return, %w wrapping |
| domain | quality |
| confidence | high |
| source | hyoka/internal/eval/engine.go, hyoka/internal/config/config.go patterns |
Hyoka follows Go's idiomatic error handling pattern: errors bubble up the call stack, and are logged at the top level (in CLI commands). This separation of concerns makes the codebase testable and keeps error flows explicit.
✓ Correct:
// In internal function
func loadConfig(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("load config: %w", err) // Wrap and return
}
// ...
}
// In CLI command (top level)
func Execute() error {
cfg, err := loadConfig(cfgPath)
if err != nil {
slog.Error("Failed to load config", "error", err) // Log once at top
return err
}
// ...
}
✗ Incorrect:
// Internal function logs AND returns
func loadConfig(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
slog.Error("Failed to read config", "error", err) // Wrong: logging here
return nil, err
}
}
%wAlways wrap lower-level errors with %w to preserve the error chain. This enables errors.Is() and errors.As() in caller code.
✓ Correct:
if err != nil {
return fmt.Errorf("failed to build project: %w", err)
}
// Caller can inspect the chain
if errors.Is(err, os.ErrNotExist) {
// Handle missing file
}
✗ Incorrect:
if err != nil {
return fmt.Errorf("failed to build project: %v", err) // Loses error chain
}
Provide actionable context at the point where error is wrapped, not repeated at logging.
✓ Correct:
// In eval engine
if err := runGrader(ctx, grader); err != nil {
return fmt.Errorf("grade with %q: %w", grader.Name(), err)
}
// In CLI command
if err != nil {
slog.Error("Evaluation failed", "error", err) // Message says what failed, details in error chain
}
%v instead of %w for error wrapping_ = someFunc()nil error when error occurredhyoka/internal/eval/engine.gohyoka/cmd/*.gohyoka/internal/logging/