All Projects → benchkram → errz

benchkram / errz

Licence: MIT License
Error Handling In One Line

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to errz

nuxt-winston-log
Nuxt module for logging SSR errors using winston
Stars: ✭ 41 (+20.59%)
Mutual labels:  error-handling
moko-errors
Automated exceptions handler for mobile (android & ios) Kotlin Multiplatform development.
Stars: ✭ 45 (+32.35%)
Mutual labels:  error-handling
rust-error-handle
detail rust error handle
Stars: ✭ 47 (+38.24%)
Mutual labels:  error-handling
dx
JavaScript without `try...catch`.
Stars: ✭ 26 (-23.53%)
Mutual labels:  error-handling
apollo-error-converter
Global Apollo Server Error handling made easy. Remove verbose and repetitive resolver / data source Error handling. Automatic Error catching, logging, and conversion to ApolloErrors.
Stars: ✭ 16 (-52.94%)
Mutual labels:  error-handling
ErrorLayout
Simple layout to show custom error toast with animation
Stars: ✭ 13 (-61.76%)
Mutual labels:  error-handling
fejl
Error-making utility for Node apps.
Stars: ✭ 30 (-11.76%)
Mutual labels:  error-handling
go-errors
Flexible, general-purpose error handling for Go.
Stars: ✭ 17 (-50%)
Mutual labels:  error-handling
whoops
It makes simple create qualified errors.
Stars: ✭ 28 (-17.65%)
Mutual labels:  error-handling
errors
Simple error handling primitives that work well with structured logging
Stars: ✭ 28 (-17.65%)
Mutual labels:  error-handling
belay
Robust error-handling for Kotlin and Android
Stars: ✭ 35 (+2.94%)
Mutual labels:  error-handling
rescue
🚒✨ Rescue: better errors through types (a more type directed MonadThrow/MonadCatch)
Stars: ✭ 18 (-47.06%)
Mutual labels:  error-handling
jsonerror
Makes Go error-handling a breeze!
Stars: ✭ 28 (-17.65%)
Mutual labels:  error-handling
sentry-testkit
A Sentry plugin to allow Sentry report interception and further inspection of the data being sent
Stars: ✭ 78 (+129.41%)
Mutual labels:  error-handling
validator
💯Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
Stars: ✭ 9,721 (+28491.18%)
Mutual labels:  error-handling
merr
🔥 Minimal and good enough error handling library for Clojure/ClojureScript
Stars: ✭ 25 (-26.47%)
Mutual labels:  error-handling
raygun4ruby
The Ruby & Ruby on Rails provider for Raygun
Stars: ✭ 37 (+8.82%)
Mutual labels:  error-handling
result
A lightweight C++11-compatible error-handling mechanism
Stars: ✭ 121 (+255.88%)
Mutual labels:  error-handling
domain-browser
Node's domain module for the web browser
Stars: ✭ 30 (-11.76%)
Mutual labels:  error-handling
ErrorHandler
This is a library for Google Apps Script projects. It provides methods to perform an Exponential backoff logic whenever it is needed and rewrite error objects before sending them to Stackdriver Logging.
Stars: ✭ 14 (-58.82%)
Mutual labels:  error-handling

GoDoc Go Report Card

errz

Package errz allows you to handle errors in one line of code.

You should use errz when you want to..
  • ..easily detect & find memory leaks like a nil pointer dereference
  • ..give context to your errors trough stack traces
  • ..avoid the verbose but idiomatic error handling pattern if err != nil { return err }
When should i not use errz?

If you write algorithms, modules or libraries with high performance in mind.

--

The name of this package was inspired by Marcel van Lohuizen.
It has a dependency on github.com/pkg/errors

Using errz

Logging

When you want to log/report an error.

err := foo()
errz.Log(err)

This is useful during development and mostly used at the top level of an application

Return on error

It means stopping further code execution and returning to the calling function. panic/recover is used to stop code execution when a error occurred.

func bar() (err error){
  defer errz.Recover(&err) //recover all panics

  err = foo()
  errz.Fatal(err) //panics on error

  //Some pieces of code.
  //Not executed when foo() returned a error
  //..
  //..

  return err
}

This pattern will not just handle errors. It will also handle memory corruptions, turns them into an error, adds a stack trace to it and returns the error. This can prevent you from extensive debugging sessions.

License

MIT

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].