pfg

package module
v0.0.0-...-3858368 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: MIT Imports: 10 Imported by: 0

README

pfg

-- import "github.com/victorhaggqvist/pfg"

Package pfg provides error helpers for detailed return errors to be used with https://github.com/grpc-ecosystem/grpc-gateway

Usage

func ErrorDetail
func ErrorDetail(code codes.Code, msg string, details ...proto.Message) error

ErrorDetail creates an error with bundled detail messages

func ErrorHandler
func ErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, rw http.ResponseWriter, req *http.Request, err error)

ErrorHandler for gRPC JSON Gateway runtime

Usage

gw := runtime.NewServeMux(
	runtime.WithProtoErrorHandler(pfg.ErrorHandler),
	runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONBuiltin{}),
)

Documentation

Overview

Package pfg provides error helpers for detailed return errors to be used with https://github.com/grpc-ecosystem/grpc-gateway

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorDetail

func ErrorDetail(code codes.Code, msg string, details ...proto.Message) error

ErrorDetail creates an error with bundled detail messages

func ErrorHandler

func ErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, rw http.ResponseWriter, req *http.Request, err error)

ErrorHandler for gRPC JSON Gateway runtime

Usage

gw := runtime.NewServeMux(
	runtime.WithProtoErrorHandler(pfg.ErrorHandler),
	runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONBuiltin{}),
)

Types

This section is empty.

Jump to

Keyboard shortcuts

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