Files
presenter/CLAUDE.md
T
argoyle 44464c0a85
presenter / test (pull_request) Successful in 2m3s
presenter / vulnerabilities (pull_request) Successful in 2m28s
fix: update module path from gitlab to git.unbound.se
Change the module path in various files to reflect the new 
repository location on git.unbound.se. Update imports in 
CLAUDE.md, error_test.go, and presenter_test.go to ensure 
compatibility with the updated module path. Remove outdated 
CI configuration in .pre-commit-config.yaml to streamline 
the setup. This enhances consistency and aligns the project 
with its new hosting platform.
2026-01-09 09:26:03 +01: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)