app

package
v0.0.0-...-dcafc8e Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeInternalError = 1000
	CodeBadParam      = 1001
	CodeNotFound      = 1002
	CodeUnauthorized  = 1003
)

Code enums.

Variables

This section is empty.

Functions

func AuthError

func AuthError() error

AuthError generates auth error.

func NotFoundError

func NotFoundError() error

NotFoundError indicates resource not found.

func ParamError

func ParamError(err error) error

ParamError generates BadParamError.

func WithCode

func WithCode(err error, code int) error

WithCode adds code to error.

Types

type App

type App struct {
	Flags  []cli.Flag
	Before func(*cli.Context) error
	After  func(*cli.Context) error
	Action func(context.Context)
}

App is cli wrapper that do some common operation and creates signal handler.

func (*App) Run

func (a *App) Run()

Run setups everything and runs Main.

type CodedError

type CodedError struct {
	Err        error
	AppCode    int
	StatusCode int
}

CodedError implements app code helper. it shouldn't be used directly.

func (*CodedError) Error

func (e *CodedError) Error() string

Error returns internal error or by status code.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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