GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - FabioKaelin/ferror: With this package it is possible to store more information about the errors

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENCE
LICENCE
 
 
README.md
README.md
 
 
ferror.go
ferror.go
 
 
go.mod
go.mod
 
 

Repository files navigation

F-Error

With this package it is possible to store more information about the errors that occur in the code, such as the error message, the layer where the error occured and a message for the user.

Usage

To import the package use go get github.com/fabiokaelin/ferror.

package main

import (
	"errors"
	"fmt"

	"github.com/fabiokaelin/ferror"
)

func main() {
	_, err1 := retrunNormalError()

	ferr1 := ferrors.FromError(err1)
	if ferr1 != nil {
		fmt.Println(ferr1)
	}

	err2 := ferrors.New("this is a ferror")
	err2.SetLayer("db")
	err2.SetUserMsg("Unable to persist the data")
	err2.SetKind("db connection")
	err2.SetInternal("db connection closed unexpectedly")
	fmt.Println(err2)
}

func retrunNormalError() (string, error) {
	return "", errors.New("this is a normal error")
}
{Error: 'this is a normal error', Layer: '', UserMsg: '', Kind: '', Internal: ''}
{Error: 'this is a ferror', Layer: 'db', UserMsg: 'Unable to persist the data', Kind: 'db connection', Internal: 'db connection closed unexpectedly'}

About

With this package it is possible to store more information about the errors

pkg.go.dev/github.com/fabiokaelin/ferror

Topics

errorf-prodgogolang

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.