{"id":22505826,"url":"https://github.com/efimovalex/stackerr","last_synced_at":"2025-08-03T12:32:09.364Z","repository":{"id":57486841,"uuid":"101853303","full_name":"efimovalex/stackerr","owner":"efimovalex","description":"An golang error implementation with StatusCode and Function trace","archived":false,"fork":false,"pushed_at":"2021-10-27T06:34:18.000Z","size":137,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T14:10:19.611Z","etag":null,"topics":["error","error-handling","error-log","function","go","golang","golang-library","stacktrace","statuscode","trace","traceability","tracker"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/efimovalex/stackerr","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/efimovalex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-30T07:53:11.000Z","updated_at":"2024-06-21T14:10:19.612Z","dependencies_parsed_at":"2022-09-01T22:51:09.025Z","dependency_job_id":null,"html_url":"https://github.com/efimovalex/stackerr","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efimovalex%2Fstackerr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efimovalex%2Fstackerr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efimovalex%2Fstackerr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efimovalex%2Fstackerr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efimovalex","download_url":"https://codeload.github.com/efimovalex/stackerr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228543702,"owners_count":17934542,"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","error-handling","error-log","function","go","golang","golang-library","stacktrace","statuscode","trace","traceability","tracker"],"created_at":"2024-12-07T00:34:33.782Z","updated_at":"2024-12-07T00:34:34.469Z","avatar_url":"https://github.com/efimovalex.png","language":"Go","readme":"# StackErr\n[![CircleCI](https://circleci.com/gh/efimovalex/stackerr/tree/master.svg?style=svg)](https://circleci.com/gh/efimovalex/stackerr/tree/master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/efimovalex/stackerr)](https://goreportcard.com/report/github.com/efimovalex/stackerr) [![codecov](https://codecov.io/gh/efimovalex/stackerr/branch/master/graph/badge.svg)](https://codecov.io/gh/efimovalex/stackerr) [![GoDoc](https://godoc.org/github.com/efimovalex/stackerr?status.svg)](https://godoc.org/github.com/efimovalex/stackerr)\n\nAn error implementation with StatusCode and Stacktrace\n\nIt implements the Golang error interface\n\nYou can use Status Code to better identify the answer you need to report to the client.\n\nMakes debugging easier by logging the functions the error passes through and by adding the ability to log context on each function pass of the error, so that you can create a path of the error through your application.  \n\n## Install\n\n```console\n$ go get github.com/efimovalex/stackerr\n```\n\n## Usage\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/efimovalex/stackerr\"\n)\n\nfunc f1() *stackerr.Err {\n\terr := stackerr.NewWithStatusCode(\"message\", http.StatusNotFound)\n\treturn err.Stack()\n}\n\nfunc f2() *stackerr.Err {\n\terr := f1()\n\treturn err.StackWithContext(\"context\")\n}\n\ntype t1 struct{}\n\nfunc (t *t1) f3() *stackerr.Err {\n\terr := f2()\n\treturn err.Stack()\n}\n\nfunc main() {\n\tts := t1{}\n\terr := ts.f3()\n\n\tfmt.Println(err.Sprint())\n\n\tfmt.Println(err.Error())\n\n\tfmt.Println(err.StatusCode)\n\n\tif err.IsNotFound() {\n\t\tfmt.Println(\"Resource is not found\")\n\t}\n\n\terr.Log()\n}\n\n```\nOutput:\n\n```console\nError Stacktrace:\n-\u003e /home/efi/workspace/stackerr/example/main.go:29 (main.main) \n-\u003e /home/efi/workspace/stackerr/example/main.go:24 (main.(*t1).f3) \n-\u003e /home/efi/workspace/stackerr/example/main.go:17 (main.f2) context\n-\u003e /home/efi/workspace/stackerr/example/main.go:11 (main.f1) \n\nmessage\n404\nResource is not found\n\n2021/10/26 17:58:11 Error Stacktrace:\n-\u003e /home/efi/workspace/stackerr/example/main.go:29 (main.main) \n-\u003e /home/efi/workspace/stackerr/example/main.go:24 (main.(*t1).f3) \n-\u003e /home/efi/workspace/stackerr/example/main.go:17 (main.f2) context\n-\u003e /home/efi/workspace/stackerr/example/main.go:11 (main.f1) \n\n2021/10/26 17:58:11 Error Stacktrace:\n-\u003e /home/efi/workspace/stackerr/example/main.go:41 (main.main) \n```\n## Authors\n\nCreated and maintained by\n\nEfimov Alex - @efimovalex\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefimovalex%2Fstackerr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefimovalex%2Fstackerr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefimovalex%2Fstackerr/lists"}