{"id":37802359,"url":"https://github.com/bdlm/errors","last_synced_at":"2026-01-16T15:27:11.866Z","repository":{"id":57485696,"uuid":"133772596","full_name":"bdlm/errors","owner":"bdlm","description":"Simple, concise error handling and annotation for Go","archived":false,"fork":false,"pushed_at":"2021-05-12T22:56:41.000Z","size":98,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T20:56:59.202Z","etag":null,"topics":["error-stacks","errors","exceptions","go","golang","stack-trace"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/bdlm/errors/v2","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/bdlm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-05-17T07:01:30.000Z","updated_at":"2024-03-23T05:25:28.000Z","dependencies_parsed_at":"2022-09-11T16:01:23.170Z","dependency_job_id":null,"html_url":"https://github.com/bdlm/errors","commit_stats":null,"previous_names":["mkenney/go-errors"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bdlm/errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdlm%2Ferrors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdlm%2Ferrors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdlm%2Ferrors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdlm%2Ferrors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdlm","download_url":"https://codeload.github.com/bdlm/errors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdlm%2Ferrors/sbom","scorecard":{"id":229128,"data":{"date":"2025-08-11","repo":{"name":"github.com/bdlm/errors","commit":"378f9b055bdca7241ba31cd72d940c1b2e57be62"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":-1,"reason":"no workflows found","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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: goCommand not pinned by hash: .travis.sh:6","Info:   0 out of   1 goCommand 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":"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":"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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-2023-2153 / GHSA-m425-mq94-257g / GHSA-qppj-fm5r-hxr3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T04:29:42.915Z","repository_id":57485696,"created_at":"2025-08-17T04:29:42.915Z","updated_at":"2025-08-17T04:29:42.915Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: 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-stacks","errors","exceptions","go","golang","stack-trace"],"created_at":"2026-01-16T15:27:11.768Z","updated_at":"2026-01-16T15:27:11.837Z","avatar_url":"https://github.com/bdlm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# errors\n\n\u003ca href=\"https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#mature\"\u003e\u003cimg src=\"https://img.shields.io/badge/stability-mature-008000.svg\" alt=\"Mature\"\u003e\u003c/a\u003e This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This package is considered mature, you should expect package stability in \u003cstrong\u003eMinor\u003c/strong\u003e and \u003cstrong\u003ePatch\u003c/strong\u003e version releases\n\n- **Major**: backwards incompatible package updates\n- **Minor**: feature additions, removal of deprecated features\n- **Patch**: bug fixes, backward compatible model and function changes, etc.\n\n**[CHANGELOG](CHANGELOG.md)**\u003cbr\u003e\n\n\u003ca href=\"https://github.com/bdlm/errors/blob/master/CHANGELOG.md\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/bdlm/errors\" alt=\"Release\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/bdlm/errors/v2#pkg-examples\"\u003e\u003cimg src=\"https://godoc.org/github.com/bdlm/errors?status.svg\" alt=\"GoDoc\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/bdlm/errors\"\u003e\u003cimg src=\"https://travis-ci.org/bdlm/errors.svg?branch=master\" alt=\"Build status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/bdlm/errors\"\u003e\u003cimg src=\"https://img.shields.io/codecov/c/github/bdlm/errors/master.svg\" alt=\"Coverage status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/bdlm/errors\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/bdlm/errors\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/bdlm/errors/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-raw/bdlm/errors.svg\" alt=\"Github issues\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/bdlm/errors/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/bdlm/errors.svg\" alt=\"Github pull requests\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/bdlm/errors/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/bdlm/errors.svg\" alt=\"MIT\"\u003e\u003c/a\u003e\n\n`errors` provides simple, concise, useful error handling and annotation. This package aims to implement the [Error Inspection](https://go.googlesource.com/proposal/+/master/design/go2draft-error-inspection.md) and [Error Values](https://go.googlesource.com/proposal/+/master/design/go2draft-error-values-overview.md) Go2 [draft designs](https://go.googlesource.com/proposal/+/master/design/go2draft.md).\n\nOne of the biggest frustrations with Go error handling is the lack of forensic and meta information errors should provide. By default errors are just a string and possibly a type. They can't tell you where they occurred or the path through the call stack they followed. The error implementation in Go is robust enough to control program flow but it's not very efficient for troubleshooting or analysis.\n\nSince the idom in Go is that we pass the error back up the stack anyway:\n```go\nif nil != err {\n\treturn err\n}\n```\nit's trivial to make errors much more informative with a simple error package. `bdlm/errors` makes this easy and supports tracing the call stack and the error callers with relative ease. Custom error types are also fully compatible with this package and can be used freely.\n\n## Install\n\n```\ngo get github.com/bdlm/errors/v2\n```\n\n## Quick start\n\nSee the [documentation](https://pkg.go.dev/github.com/bdlm/errors#pkg-examples) for more examples. All package methods work with any `error` type as well as `nil` values, and error instances implement the [`Unwrap`](https://go.googlesource.com/proposal/+/master/design/go2draft-error-inspection.md), [`Is`](https://go.googlesource.com/proposal/+/master/design/go2draft-error-inspection.md), [`Marshaler`](https://golang.org/pkg/encoding/json/#Marshaler), and [`Formatter`](https://golang.org/pkg/fmt/#Formatter) interfaces as well as the [`github.com/bdlm/std/errors`](https://github.com/bdlm/std/tree/master/errors) interfaces.\n\n#### Create an error\n```go\nvar MyError = errors.New(\"My error\")\n```\n\n#### Create an error using formatting verbs\n```go\nvar MyError = errors.Errorf(\"My error #%d\", 1)\n```\n\n#### Wrap an error\n```go\nif nil != err {\n\treturn errors.Wrap(err, \"the operation failed\")\n}\n```\n\n#### Wrap an error with another error\n```go\nerr := try1()\nif nil != err {\n\terr2 := try2()\n\tif nil != err2 {\n\t\treturn errors.WrapE(err, err2)\n\t}\n\treturn err\n}\n```\n\n#### Get the previous error, if any\n```go\nerr := doWork()\nif prevErr := errors.Unwrap(err); nil != prevErr {\n\t...\n}\n```\n\n#### Test to see if a specific error type exists anywhere in an error stack\n```go\nvar MyError = errors.New(\"My error\")\nfunc main() {\n\terr := doWork()\n\tif errors.Is(err, MyError) {\n\t\t...\n\t}\n}\n```\n\n#### Iterate through an error stack\n```go\nerr := doWork()\nfor nil != err {\n\tfmt.Println(err)\n\terr = errors.Unwrap(err)\n}\n```\n\n#### Formatting verbs\n`errors` implements the `%s` and `%v` [`fmt.Formatter`](https://golang.org/pkg/fmt/#hdr-Printing) formatting verbs and several modifier flags:\n\n##### Verbs\n* `%s` - Returns the error string of the last error added.\n* `%v` - Alias for `%s`\n\n##### Flags\n* `#` - JSON formatted output, useful for logging\n* `-` - Output caller details, useful for troubleshooting\n* `+` - Output full error stack details, useful for debugging\n* ` ` - (space) Add whitespace formatting for readability, useful for development\n\n##### Examples\n`fmt.Printf(\"%s\", err)`\n```\nAn error occurred\n```\n`fmt.Printf(\"%v\", err)`\n```\nAn error occurred\n```\n`fmt.Printf(\"%-v\", err)`\n```\n#0 stack_test.go:40 (github.com/bdlm/error_test.TestErrors) - An error occurred\n```\n`fmt.Printf(\"%+v\", err)`\n```\n#0 stack_test.go:40 (github.com/bdlm/error_test.TestErrors) - An error occurred #1 stack_test.go:39 (github.com/bdlm/error_test.TestErrors) - An error occurred\n```\n`fmt.Printf(\"%#v\", err)`\n```json\n{\"error\":\"An error occurred\"}\n```\n`fmt.Printf(\"%#-v\", err)`\n```json\n{\"caller\":\"#0 stack_test.go:40 (github.com/bdlm/error_test.TestErrors)\",\"error\":\"An error occurred\"}\n```\n`fmt.Printf(\"%#+v\", err)`\n```json\n[{\"caller\":\"#0 stack_test.go:40 (github.com/bdlm/error_test.TestErrors)\",\"error\":\"An error occurred\"},{\"caller\":\"#1 stack_test.go:39 (github.com/bdlm/error_test.TestErrors)\",\"error\":\"An error occurred\"}]\n```\n`fmt.Printf(\"% #-v\", err)`\n```json\n{\n    \"caller\": \"#0 stack_test.go:40 (github.com/bdlm/error_test.TestErrors)\",\n    \"error\": \"An error occurred\"\n}\n```\n`fmt.Printf(\"% #+v\", err)`\n```json\n[\n    {\n        \"caller\": \"#0 stack_test.go:40 (github.com/bdlm/error_test.TestErrors)\",\n        \"error\": \"An error occurred\"\n    },\n    {\n        \"caller\": \"#1 stack_test.go:39 (github.com/bdlm/error_test.TestErrors)\",\n        \"error\": \"An error occurred\"\n    }\n]\n```\n\n#\n\nSee the [documentation](https://godoc.org/github.com/bdlm/errors#pkg-examples) for more examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdlm%2Ferrors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdlm%2Ferrors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdlm%2Ferrors/lists"}