All Projects → kataras → go-errors

kataras / go-errors

Licence: MIT license
⚠️ Better GoLang error handling.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-errors

Tcso
Try Catch Stack overflow (TcSo) Is a collection of Try statements in all the programming languages under the globe which catches the exception and searches for the cause of the caught exception in the stack overflow automatically.
Stars: ✭ 228 (+1166.67%)
Mutual labels:  error-handling
errors
errors with paired message and caller stack frame
Stars: ✭ 19 (+5.56%)
Mutual labels:  error-handling
react-ssr-error-boundary
No description or website provided.
Stars: ✭ 33 (+83.33%)
Mutual labels:  error-handling
Poica
🧮 A research programming language on top of C macros
Stars: ✭ 231 (+1183.33%)
Mutual labels:  error-handling
hutplate
A Go library over standard net/http library with auth, session, err handling and more.
Stars: ✭ 28 (+55.56%)
Mutual labels:  error-handling
laravel-ignition
A beautiful error page for Laravel apps
Stars: ✭ 276 (+1433.33%)
Mutual labels:  error-handling
Human Signals
Human-friendly process signals
Stars: ✭ 223 (+1138.89%)
Mutual labels:  error-handling
classy-optics
🔎 Source code shown at my talks at Scale by the Bay 2018 and Scalar 2019
Stars: ✭ 25 (+38.89%)
Mutual labels:  error-handling
cakephp-error-email
ErrorEmail Plugin for CakePHP3.x
Stars: ✭ 16 (-11.11%)
Mutual labels:  error-handling
errorist
Utilities for coping with errors and panics like a boss in Go
Stars: ✭ 19 (+5.56%)
Mutual labels:  error-handling
Webpack Messages
Beautifully format Webpack messages throughout your bundle lifecycle(s)!
Stars: ✭ 238 (+1222.22%)
Mutual labels:  error-handling
teapot
Utilities for working with HTTP status codes, errors, and more
Stars: ✭ 14 (-22.22%)
Mutual labels:  error-handling
catchr
catchr: Flexible, useful tools for dealing with conditions in R, for new users and veterans
Stars: ✭ 17 (-5.56%)
Mutual labels:  error-handling
Grace
Handle Go recover, panic, and errors in a graceful way. Multiple errors support, basic filters and custom handlers.
Stars: ✭ 229 (+1172.22%)
Mutual labels:  error-handling
bugsnag-java
Bugsnag error reporting for Java.
Stars: ✭ 51 (+183.33%)
Mutual labels:  error-handling
Sneaker
An easy way to send emails whenever an exception occurs on server.
Stars: ✭ 223 (+1138.89%)
Mutual labels:  error-handling
fail
Better error handling solution specially designed for web application servers
Stars: ✭ 27 (+50%)
Mutual labels:  error-handling
sealed-monad
Scala library for nice business logic oriented, for-comprehension-style error handling
Stars: ✭ 16 (-11.11%)
Mutual labels:  error-handling
bugsnag-vue
[DEPRECATED] This package now lives within the monorepo for our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
Stars: ✭ 26 (+44.44%)
Mutual labels:  error-handling
ddderr
👺 Reflection-free Domain-Driven errors for Go.
Stars: ✭ 29 (+61.11%)
Mutual labels:  error-handling

Build Status License Releases Read me docs Build Status Built with GoLang Platforms

This package provides a way to initialize possible errors and handle them with ease.

Installation

The only requirement is the Go Programming Language.

$ go get -u github.com/kataras/go-errors

Docs

New

New receives a message format and creates a new Error. Message format, which is created with .New, is never changes.

import "github.com/kataras/go-errors"

var errUserAlreadyJoined = errors.New("User with username: %s was already joined in this room!")

Format

Format is like fmt.Sprintf but for specific Error, returns a new error with the formatted message.

import "github.com/kataras/go-errors"

var errUserAlreadyJoined = errors.New("User with username: %s was already joined in this room!")

func anything() error {
  return errUserAlreadyJoined.Format("myusername")
  // will return an error with message =
  // User with username: myusername was already joined in this room!
  //
}

Append

Append and AppendErr adds a message to existing message and returns a new error.

import "github.com/kataras/go-errors"

var errUserAlreadyJoined = errors.New("User with username: %s was already joined in this room!")

func anything() error {
  return errUserAlreadyJoined.Append("Please specify other room.").Format("myusername")
  // will return an error with message =
  // User with username: myusername was already joined in this room!
  // Please specify other room.
  //
}
import "github.com/kataras/go-errors"

var errUserAlreadyJoined = errors.New("User with username: %s was already joined in this room!")
var errSpecifyOtherRoom  = errors.New("Please specify other room.")

func anything() error {
  return errUserAlreadyJoined.AppendErr(errSpecifyOtherRoom).Format("myusername")
  // will return an error with message =
  // User with username: myusername was already joined in this room!
  // Please specify other room.
  //
}

Use AppendErr with go standard error type

import (
  "github.com/kataras/go-errors"
  "fmt"
)

var errUserAlreadyJoined = errors.New("User with username: %s was already joined in this room!")

func anything() error {
  err := fmt.Errorf("Please specify other room") // standard golang error

  return errUserAlreadyJoined.AppendErr(err).Format("myusername")
  // will return an error with message =
  // User with username: myusername was already joined in this room!
  // Please specify other room.
  //
}

FAQ

Explore these questions or navigate to the community chat.

Versioning

Current: v0.0.4

People

The author of go-errors is @kataras.

Contributing

If you are interested in contributing to the go-errors project, please make a PR.

License

This project is licensed under the MIT License.

License can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].