{"id":27881842,"url":"https://github.com/src-d/go-errors","last_synced_at":"2025-07-08T08:04:52.068Z","repository":{"id":57481179,"uuid":"75004639","full_name":"src-d/go-errors","owner":"src-d","description":"Yet another errors package, implementing error handling primitives.","archived":false,"fork":false,"pushed_at":"2019-09-30T12:56:36.000Z","size":19,"stargazers_count":23,"open_issues_count":3,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-05T05:05:43.565Z","etag":null,"topics":["error-handling","golang","stacktrace"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/src-d.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":"2016-11-28T18:58:11.000Z","updated_at":"2024-08-01T01:36:01.000Z","dependencies_parsed_at":"2022-09-06T17:11:24.134Z","dependency_job_id":null,"html_url":"https://github.com/src-d/go-errors","commit_stats":null,"previous_names":["src-d/errors"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/src-d/go-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/src-d","download_url":"https://codeload.github.com/src-d/go-errors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-errors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264229252,"owners_count":23576239,"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","golang","stacktrace"],"created_at":"2025-05-05T05:05:41.481Z","updated_at":"2025-07-08T08:04:51.983Z","avatar_url":"https://github.com/src-d.png","language":"Go","readme":"# go-errors [![GoDoc](https://godoc.org/gopkg.in/src-d/go-errors.v1?status.svg)](https://godoc.org/gopkg.in/src-d/go-errors.v1) [![Build Status](https://travis-ci.org/src-d/go-errors.svg?branch=master)](https://travis-ci.org/src-d/go-errors) [![codecov](https://codecov.io/gh/src-d/go-errors/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/go-errors) [![codebeat badge](https://codebeat.co/badges/e0c5d481-6200-4112-9144-f750317421f0)](https://codebeat.co/projects/github-com-src-d-go-errors)\n\nYet another `errors` package, implementing error handling primitives with error wrapping and error tracing.\n\n## Installation\n\nThe recommended way to install go-errors is:\n\n```\ngo get -u gopkg.in/src-d/go-errors.v1\n```\n\n## Examples\n\nThe `Kind` type allows you to create new errors containing the stack trace and also check if an error is of a particular kind.\n\n```go\nvar ErrExample = errors.NewKind(\"example\")\n\nerr := ErrExample.New()\nif ErrExample.Is(err) {\n\tfmt.Printf(\"%+v\\n\", err)\n}\n\n// Example Output:\n// example\n//\n// gopkg.in/src-d/errors%2v0_test.ExampleError_Format\n//         /home/mcuadros/workspace/go/src/gopkg.in/src-d/errors.v0/example_test.go:60\n// testing.runExample\n//         /usr/lib/go/src/testing/example.go:114\n// testing.RunExamples\n//         /usr/lib/go/src/testing/example.go:38\n// testing.(*M).Run\n//         /usr/lib/go/src/testing/testing.go:744\n// main.main\n//         github.com/pkg/errors/_test/_testmain.go:106\n// runtime.main\n//         /usr/lib/go/src/runtime/proc.go:183\n// runtime.goexit\n//         /usr/lib/go/src/runtime/asm_amd64.s:2086\n```\n\n\n### Error with format\n\n```go\nvar ErrMaxLimitReached = errors.NewKind(\"max. limit reached: %d\")\n\nerr := ErrMaxLimitReached.New(42)\nif ErrMaxLimitReached.Is(err) {\n    fmt.Println(err)\n}\n\n// Output: max. limit reached: 42\n```\n\n\n### Error wrapping\n\n```go\nvar ErrNetworking = errors.NewKind(\"network error\")\n\nerr := ErrNetworking.Wrap(io.EOF)\nif ErrNetworking.Is(err) {\n    fmt.Println(err)\n}\n\n// Output: network error: EOF\n```\n\nYou can find these examples and many more in the [examples](example_test.go) file.\n\n\n## License\n\nApache License 2.0, see [LICENSE](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrc-d%2Fgo-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrc-d%2Fgo-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrc-d%2Fgo-errors/lists"}