Skip to content

Generic error package that can be used to handle errors in your applications, services or any other "adapter" your service may use

Notifications You must be signed in to change notification settings

Christochi/error-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

error-handler

Description

Generic error package that can be used to handle errors in your applications, services or any other "adapter" your service may use

Setup

  • import the package using go get or go mod tidy commands
    • using go get: on the terminal of your project directory, paste: go get github.com/Christochi/error-handler
    • paste github.com/Christochi/error-handler/service on the import block of your code, and on the terminal, run go mod tidy

Usage Example

func openFile() error {
	if _, err := os.Open("no-file"); err != nil {
		return service.NewError(err, "file does not exist")
	}

	return nil
}
err := openFile()

var svcErr *service.ServiceError
if errors.As(err, &svcErr){
   // your implementation
}

About

Generic error package that can be used to handle errors in your applications, services or any other "adapter" your service may use

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages