problem

package
v0.1.0-rc.46 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0 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 problemtype defines canonical API problem type URIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserResponse

func BrowserResponse(w http.ResponseWriter, r *http.Request) http.ResponseWriter

BrowserResponse opts a browser endpoint into html problems without changing api responses. the existing problem writer still owns codes and correlation.

func HelpURL

func HelpURL(code, caseID string) string

HelpURL adds only known, non-sensitive context; the problem type stays canonical.

func Is

func Is(problemURI, code string) bool

Is compares a problem URI to an identifier without duplicating URI spelling.

func NewRequestID

func NewRequestID() string

func URL

func URL(code string) string

URL returns the URI for an API problem code or private problem identifier.

func Write

func Write(response http.ResponseWriter, status int, code, title, detail, caseID string) string

Write sends an authored problem once and returns the ID for operational logs.

func WriteWithDetails

func WriteWithDetails(response http.ResponseWriter, status int, code, title, detail, caseID string, details map[string]any) string

WriteWithDetails sends the same envelope with diagnostic fields approved by the serving API. callers own field selection and validation, not wire framing.

Types

type Problem

type Problem struct {
	Type      string         `json:"type"`
	Title     string         `json:"title"`
	Status    int            `json:"status"`
	Code      string         `json:"code"`
	Detail    string         `json:"detail"`
	RequestID string         `json:"request_id"`
	Details   map[string]any `json:"details"`
}

Problem is the shared HTTP error envelope. an API owns its allowed codes, while this writer owns the fields and request correlation across services.

Jump to

Keyboard shortcuts

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