fibercommon

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fibercommon provides common fiber related utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextLoggerMiddleware

func ContextLoggerMiddleware(c *fiber.Ctx) error

ContextLoggerMiddleware adds the http metadata to the logger and adds the logger to the context.

func ErrorHandler

func ErrorHandler(ctx *fiber.Ctx, err error) error

ErrorHandler is a custom handler to log recovered errors using our logger and return json instead of string. This handler is aware of the richerrors package and will use the code and message from the error if available. It will also log the error to the set in the user context logger.

Types

type CodedResponse

type CodedResponse struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

CodedResponse is a response that includes a code and a message.

Jump to

Keyboard shortcuts

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