errors

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 1 Imported by: 16

README

Errors

Error types

Usage

Quick usage

import "github.com/gflydev/core/errors"

panic(errors.ItemNotFound)

Documentation

Index

Constants

View Source
const (
	NA                = Error("N/A") // Special error type.
	NotYetImplemented = Error("Not yet implemented")
	Unauthenticated   = Error("Failed auth")   // Authentication - Who are you?
	Unauthorized      = Error("Access Denied") // Authorization -Are you allow to do that?
	InvalidToken      = Error("Invalid token")
	InvalidRequest    = Error("Invalid request")
	InvalidHeader     = Error("Invalid header")
	MissingHeader     = Error("Missing header")
	ServiceDown       = Error("Service unavailable")
	InvalidParameter  = Error("Invalid parameter") // Common error case about invalid parameter
	ItemNotFound      = Error("Item not found")    // Common error case item not found
)

Variables

This section is empty.

Functions

func New added in v1.7.1

func New(format string, args ...any) error

New returns an error message and arguments

Types

type Error

type Error string

Error type

func (Error) Error

func (e Error) Error() string

Error returns the error message

type FileNotFound

type FileNotFound struct {
	FileName string `json:"fileName"`
	Path     string `json:"path"`
}

FileNotFound is used when a requested file is not found in the system

func (FileNotFound) Error

func (f FileNotFound) Error() string

Error returns an error message indicating that the file was not found

Jump to

Keyboard shortcuts

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