httperr

package
v0.229.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package httperr writes JSON error responses in either Auth0 Management API shape or Auth0 Authentication API shape.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteAuth

func WriteAuth(w http.ResponseWriter, status int, errCode, description string)

WriteAuth writes an Authentication-API-shaped JSON error. Same disconnect semantics as WriteMgmt — see its doc for why the encode error is dropped.

func WriteMgmt

func WriteMgmt(w http.ResponseWriter, status int, errStr, message, errorCode string)

WriteMgmt writes a Management-API-shaped JSON error.

Encode errors here only fire when the client has already disconnected (broken pipe, write deadline) — the status line and headers have already been written by that point and there is nothing useful to do about it, so the result is intentionally discarded.

Types

type AuthError

type AuthError struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description,omitempty"`
}

AuthError matches Auth0 Authentication API error responses.

type MgmtError

type MgmtError struct {
	StatusCode int    `json:"statusCode"`
	Error      string `json:"error"`
	Message    string `json:"message"`
	ErrorCode  string `json:"errorCode,omitempty"`
}

MgmtError matches Auth0 Management API error responses.

Jump to

Keyboard shortcuts

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