{"id":19608588,"url":"https://github.com/teamwork/guru","last_synced_at":"2025-04-27T20:32:55.152Z","repository":{"id":57490585,"uuid":"96228988","full_name":"Teamwork/guru","owner":"Teamwork","description":"Go errors with a Guru Meditation Number","archived":false,"fork":false,"pushed_at":"2024-10-21T12:04:56.000Z","size":59,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-04-05T03:12:44.692Z","etag":null,"topics":["go"],"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/Teamwork.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":"2017-07-04T14:55:25.000Z","updated_at":"2024-10-26T21:02:52.000Z","dependencies_parsed_at":"2022-09-08T04:51:25.969Z","dependency_job_id":null,"html_url":"https://github.com/Teamwork/guru","commit_stats":null,"previous_names":["teamwork/httperr"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fguru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fguru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fguru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fguru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Teamwork","download_url":"https://codeload.github.com/Teamwork/guru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251204666,"owners_count":21552264,"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":["go"],"created_at":"2024-11-11T10:15:50.673Z","updated_at":"2025-04-27T20:32:54.859Z","avatar_url":"https://github.com/Teamwork.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/Teamwork/guru.svg?branch=master)](https://travis-ci.com/Teamwork/guru)\n[![Codecov](https://img.shields.io/codecov/c/github/Teamwork/guru.svg?style=flat)](https://codecov.io/gh/Teamwork/guru)\n[![GoDoc](https://godoc.org/github.com/Teamwork/guru?status.svg)](http://godoc.org/github.com/Teamwork/guru)\n\nThe guru package allows adding a Guru Meditation Number to errors:\n\n```go\n// Error constants.\nconst (\n\tCodeFruitOverflow = iota + 1\n\tCodeBoozeUnderrun\n\tCodeExpired\n)\n\nfunc Example() {\n\t// Construct a new error.\n\terr := guru.New(CodeFruitOverflow, \"too many bananas\")\n\tfmt.Println(err) // error 1: too many bananas\n\n\t// Retrieve the error code\n\tcode := guru.Code(err)\n\tfmt.Println(code) // 1\n\n\t// Add error code to existing error.\n\terr = errors.New(\"not enough beer\")\n\terr = guru.WithCode(CodeBoozeUnderrun, err)\n\tfmt.Println(err) // error 2: not enough beer\n\n\t// Add error code to existing error with context.\n\terr = errors.New(\"Dennis Ritchie\")\n\terr = guru.Wrap(CodeExpired, err, \"no longer with us\")\n\tfmt.Println(err) // error 3: Dennis Ritchie: no longer with us\n\n\t// For HTTP applications, it may be useful to directly the HTTP status codes:\n\terr = guru.New(http.StatusNotAcceptable, \"Justin Bieber\")\n\tfmt.Println(err) // error 406: Justin Bieber\n\n\t// Error codes can be overriden:\n\terr = guru.New(1, \"oh noes\")\n\terr = guru.WithCode(2, err)\n\tfmt.Println(guru.Code(err)) // 2\n}\n```\n\nguru is built on top of [github.com/pkg/errors](https://github.com/pkg/errors);\nall errors that guru returns are github.com/pkg/errors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamwork%2Fguru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteamwork%2Fguru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamwork%2Fguru/lists"}