Files
presenter/CLAUDE.md
T
argoyleandClaude Opus 5.5 7b879c3fc0
presenter / vulnerabilities (pull_request) Successful in 41s
pre-commit / pre-commit (pull_request) Successful in 2m47s
presenter / test (pull_request) Successful in 4m21s
feat: move module path to git.unbound.se
The module is now git.unbound.se/shiny/presenter. The API is unchanged. Tags up to v0.3.7 declare gitea.unbound.se/shiny/presenter and stay resolvable through that alias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kko4x3MYEcWMMdkx12WpBa
2026-10-17 19:54:55 +02:00

1.1 KiB

presenter

Shared Go library for GraphQL error presentation with coded errors.

Shared Documentation

@../docs/claude/architecture.md @../docs/claude/go-services.md @../docs/claude/graphql.md @../docs/claude/conventions.md

Library Information

Purpose

Provides a standardized GraphQL error presenter that handles coded errors across all microservices. Converts internal error codes to GraphQL error extensions.

Usage

import "git.unbound.se/shiny/presenter"

// Create error presenter with valid codes and entities
errorPresenter := presenter.New(logger, validCodes, validEntities, internalErrorCode)

// Use in gqlgen server config
srv := handler.NewDefaultServer(generated.NewExecutableSchema(cfg))
srv.SetErrorPresenter(errorPresenter)

Key Types

  • CodedError - Error type with code, entity, and params
  • Code - Error code type
  • Entity - Error entity type

Error Extensions

Errors are presented with extensions:

  • code - The error code (mapped to valid codes or internal error)
  • errorEntity - The entity related to the error (optional)
  • params - Additional error parameters (optional)