{"id":37153930,"url":"https://github.com/icelolly/go-errors","last_synced_at":"2026-01-14T18:04:22.478Z","repository":{"id":57499158,"uuid":"187061823","full_name":"icelolly/go-errors","owner":"icelolly","description":"Flexible, general-purpose error handling for Go.","archived":false,"fork":false,"pushed_at":"2021-09-27T10:29:29.000Z","size":21,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-14T05:51:39.158Z","etag":null,"topics":["error","error-handling","error-wrapping","errors","go","golang","stack-trace","stacktrace"],"latest_commit_sha":null,"homepage":"https://www.icelolly.com/","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/icelolly.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":"2019-05-16T16:12:13.000Z","updated_at":"2023-01-20T14:14:23.000Z","dependencies_parsed_at":"2022-08-28T15:21:13.413Z","dependency_job_id":null,"html_url":"https://github.com/icelolly/go-errors","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/icelolly/go-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelolly%2Fgo-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelolly%2Fgo-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelolly%2Fgo-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelolly%2Fgo-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icelolly","download_url":"https://codeload.github.com/icelolly/go-errors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelolly%2Fgo-errors/sbom","scorecard":{"id":480016,"data":{"date":"2025-08-11","repo":{"name":"github.com/icelolly/go-errors","commit":"396bcc2d365284183263caa37238aad3df03802f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/icelolly/go-errors/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/icelolly/go-errors/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/icelolly/go-errors/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/icelolly/go-errors/test.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2021-0053 / GHSA-c3h9-896r-86jm"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T16:22:10.551Z","repository_id":57499158,"created_at":"2025-08-19T16:22:10.551Z","updated_at":"2025-08-19T16:22:10.551Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28429451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-wrapping","errors","go","golang","stack-trace","stacktrace"],"created_at":"2026-01-14T18:04:21.690Z","updated_at":"2026-01-14T18:04:22.472Z","avatar_url":"https://github.com/icelolly.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-errors [![Workflow Badge]][Workflow] [![Go Report Card Badge]][Go Report Card] [![GoDoc Badge]][GoDoc]\n\nThis package aims to provide flexible general-purpose error handling functionality, with the\nfollowing specific features in mind:\n\n* **Error wrapping**: Allowing an error's cause to be preserved along with additional information.\n* **Stack tracing**: Allowing the path taken to return an error to be easily identified.\n* **Structured fields**: Allowing errors to be logged with additional contextual information.\n\nThis library has built upon the mistakes we've made and lessons we've learnt with regards to error\nhandling at Icelolly whilst working on our internal APIs. This library was inspired by approaches\nfound elsewhere in the community, most notably the approach found in [Upspin][1].\n\n## Usage\n\n### Creating and Wrapping Errors\n\nErrors may have a few different pieces of information attached to them; an `errors.Kind`, a message,\nand fields. All of these things are optional, but at least an `errors.Kind` _or_ message must be\ngiven if using `errors.New`. Along with this information, file and line information will be added\nautomatically. If you're wrapping an error, the only thing you must pass is an error to wrap as the\nfirst argument:\n\n```go\nconst ErrInvalidName errors.Kind = \"auth: user's name is invalid\"\n\nfunc persistUser(user *User) error {\n    if user.Name == \"\" {\n        // Error kinds like `ErrInvalidName` can be used to react to different\n        // errors to decide how to handle them at the caller.\n        return errors.New(ErrInvalidName)\n    }\n\n    err := persist(user)\n    if err != nil {\n        // Wrapping errors let's you add contextual information which may be\n        // extracted again later (e.g. for logging).\n        return errors.Wrap(err, \"auth: failed to persist user in DB\").\n            WithField(\"user\", user)\n    }\n\n    return nil\n}\n```\n\n### Handling Errors\n\nMost error handling is done using `errors.Is`, which checks if the given error is of a given\n`errors.Kind`. If the error doesn't have it's own `errors.Kind`, then `errors.Is` will look through\nthe errors stack until it finds an `errors.Kind`:\n\n```go\nfunc registerUserHandler(w http.ResponseWriter, r *http.Request) {\n    user := // ...\n\n    err := persistUser(user)\n    switch {\n    case errors.Is(err, ErrInvalidName):\n        http.Error(w, \"user has invalid username\", 400)\n        return\n    case err != nil:\n        http.Error(w, http.StatusText(500), 500)\n        return\n    }\n\n    // ...\n}\n```\n\nA more thorough example of usage can be found in the `example/` directory. It showcases creating\nerrors, wrapping them, handling different kinds of errors, and dealing with things like logging.\n\n## See More\n\n* https://github.com/upspin/upspin/tree/master/errors\n* https://middlemost.com/failure-is-your-domain/\n\n\n[1]: https://github.com/upspin/upspin/blob/master/errors/errors.go#L23\n\n[GoDoc]: https://godoc.org/github.com/icelolly/go-errors\n[GoDoc Badge]: https://godoc.org/github.com/icelolly/go-errors?status.svg\n\n[Go Report Card]: https://goreportcard.com/report/github.com/icelolly/go-errors\n[Go Report Card Badge]: https://goreportcard.com/badge/github.com/icelolly/go-errors\n\n[Workflow]: https://github.com/icelolly/go-errors/actions?query=workflow%3Atest\n[Workflow Badge]: https://github.com/icelolly/go-errors/workflows/test/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficelolly%2Fgo-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficelolly%2Fgo-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficelolly%2Fgo-errors/lists"}