44464c0a85
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.
1.1 KiB
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 paramsCode- Error code typeEntity- 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)