{"id":18412620,"url":"https://github.com/benchkram/errz","last_synced_at":"2025-04-07T11:32:07.048Z","repository":{"id":57486240,"uuid":"116804166","full_name":"benchkram/errz","owner":"benchkram","description":"Error Handling In One Line","archived":false,"fork":false,"pushed_at":"2021-12-10T13:52:15.000Z","size":21,"stargazers_count":40,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T17:11:26.498Z","etag":null,"topics":["error-handling","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benchkram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-09T10:54:14.000Z","updated_at":"2024-01-23T11:17:14.000Z","dependencies_parsed_at":"2022-09-01T22:30:53.362Z","dependency_job_id":null,"html_url":"https://github.com/benchkram/errz","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benchkram%2Ferrz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benchkram%2Ferrz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benchkram%2Ferrz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benchkram%2Ferrz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benchkram","download_url":"https://codeload.github.com/benchkram/errz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247644394,"owners_count":20972280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["error-handling","go","golang"],"created_at":"2024-11-06T03:42:51.248Z","updated_at":"2025-04-07T11:32:02.032Z","avatar_url":"https://github.com/benchkram.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](http://godoc.org/github.com/benchkram/errz)\n[![Go Report Card](https://goreportcard.com/badge/github.com/equanox/gotron)](https://goreportcard.com/report/github.com/equanox/gotron)\n# errz\nPackage errz allows you to handle errors in one line of code.\n\n##### You should use errz when you want to..\n  * ..easily detect \u0026 find memory leaks like a nil pointer dereference\n  * ..give context to your errors trough stack traces\n  * ..avoid the verbose but idiomatic error handling pattern `if err != nil { return err }`\n\n\n##### When should i **not** use errz?\nIf you write algorithms, modules or libraries with high performance in mind.\n\n--\n\nThe name of this package was inspired by [Marcel van Lohuizen](https://github.com/mpvl).  \nIt has a dependency on [github.com/pkg/errors ](https://github.com/pkg/errors)\n\n## Using errz\n#### Logging\nWhen you want to log/report an error.\n\n```go\nerr := foo()\nerrz.Log(err)\n```\nThis is useful during development and mostly used at the top level of an application\n\n#### Return on error\nIt means stopping further code execution and returning to the calling function. panic/recover is used to stop code execution when a error occurred.\n```go\nfunc bar() (err error){\n  defer errz.Recover(\u0026err) //recover all panics\n\n  err = foo()\n  errz.Fatal(err) //panics on error\n\n  //Some pieces of code.\n  //Not executed when foo() returned a error\n  //..\n  //..\n\n  return err\n}\n```\nThis 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.\n\n# License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenchkram%2Ferrz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenchkram%2Ferrz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenchkram%2Ferrz/lists"}