{"id":16843207,"url":"https://github.com/jbowes/vice","last_synced_at":"2025-07-12T22:42:04.599Z","repository":{"id":35157151,"uuid":"185187959","full_name":"jbowes/vice","owner":"jbowes","description":"Definitions of common bad behaviours for Go error values","archived":false,"fork":false,"pushed_at":"2023-03-15T17:14:15.000Z","size":48,"stargazers_count":13,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T04:41:21.172Z","etag":null,"topics":["error-handling","errors","go","go2","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbowes.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-06T11:59:45.000Z","updated_at":"2021-11-01T18:22:29.000Z","dependencies_parsed_at":"2024-06-21T02:14:59.850Z","dependency_job_id":"3eafb6c5-c0e5-4865-b580-e3f234c2e539","html_url":"https://github.com/jbowes/vice","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbowes%2Fvice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbowes%2Fvice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbowes%2Fvice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbowes%2Fvice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbowes","download_url":"https://codeload.github.com/jbowes/vice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358549,"owners_count":21090401,"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","errors","go","go2","golang"],"created_at":"2024-10-13T12:49:58.527Z","updated_at":"2025-04-11T06:43:49.594Z","avatar_url":"https://github.com/jbowes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n  Attractive html formatting for rendering in github. sorry text editor\n  readers! Besides the header and section links, everything should be clean and\n  readable.\n--\u003e\n\u003ch1 align=\"center\"\u003evice\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\u003ci\u003eStandard bad behaviours for \u003ca href=\"https://golang.org\"\u003eGo\u003c/a\u003e error values\u003c/i\u003e\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://godoc.org/github.com/jbowes/vice\"\u003e\u003cimg src=\"https://godoc.org/github.com/jbowes/vice?status.svg\" alt=\"GoDoc\"\u003e\u003c/a\u003e\n  \u003cimg alt=\"Alpha Quality\" src=\"https://img.shields.io/badge/status-ALPHA-orange.svg\" \u003e\n  \u003ca href=\"https://github.com/jbowes/vice/actions/workflows/go.yml\"\u003e\u003cimg alt=\"Build Status\" src=\"https://github.com/jbowes/vice/actions/workflows/go.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/jbowes/vice/releases/latest\"\u003e\u003cimg alt=\"GitHub tag\" src=\"https://img.shields.io/github/tag/jbowes/vice.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"./LICENSE\"\u003e\u003cimg alt=\"BSD license\" src=\"https://img.shields.io/badge/license-BSD-blue.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/jbowes/vice\"\u003e\u003cimg alt=\"codecov\" src=\"https://img.shields.io/codecov/c/github/jbowes/vice.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/jbowes/vice\"\u003e\u003cimg alt=\"Go Report Card\" src=\"https://goreportcard.com/badge/github.com/jbowes/vice\"\u003e\u003c/a\u003e\n\u003c/div\u003e\u003cbr /\u003e\u003cbr /\u003e\n\n\n## Introduction\nIntroduction | [Examples] | [Usage] | [Contributing] \u003cbr /\u003e\u003cbr /\u003e\n\n🚧 ___Disclaimer___: _`vice` is alpha quality software. The API may change\nwithout warning between revisions._ 🚧\n\n`vice` provides bad behaviours for the new [Go] 2/1.13+ error values.\n\n\n## Examples\n[Introduction] | Examples | [Usage] | [Contributing] \u003cbr /\u003e\u003cbr /\u003e\n\n*Create an error that implements `NotFound() bool`:*\n```go\nvice.New(vice.NotFound, \"user not found\")\n```\n\n*Wrap an existing error, and add `Timeout() bool`:*\n```go\nvice.Wrap(err, vice.Timeout, \"request timed out\")\n```\n\nFor complete examples and usage, see the [GoDoc documentation](https://godoc.org/github.com/jbowes/vice).\n\n\n## Usage\n[Introduction] | [Examples] | Usage | [Contributing] \u003cbr /\u003e\u003cbr /\u003e\n\n`vice` defines common types of errors, as seen in existing packages, as expressed\nthrough methods on the errors of the form:\n```go\nBehaviourName() bool // returns true\n```\n\nErrors of these types can be created and checked by vice. When used with Go 2\nerror value wrapping, intermediate code layers don't have to know about the\nbehaviours or types of errors, and may add additional information, without\naltering how the error is handled in the topmost layer:\n\n```go\n// Create an error when your database can't find a user record\nerr := vice.New(vice.NotFound, \"user not found\")\n\n// many intermediate layers of code, passing the error on, and wrapping it\n// ...\n\n// In your central request handler middleware\nif vice.Is(err, vice.NotFound) {\n\t// respond appropriately to the client\n}\n```\n\n### Building APIs on `vice`\n\n`vice/skip` implements the `vice` API with an additional `skip` argument,\nallowing creation of APIs on top of `vice` that will not report themselves in\nerror caller frames.\n\n\n## Contributing\n[Introduction] | [Examples] | [Usage] | Contributing \u003cbr /\u003e\u003cbr /\u003e\n\nI would love your help!\n\n`vice` is still a work in progress. You can help by:\n\n- Opening a pull request to resolve an [open issue][issues].\n- Adding a feature or enhancement of your own! If it might be big, please\n  [open an issue][enhancement] first so we can discuss it.\n- Improving this `README` or adding other documentation to `vice`.\n- Letting [me] know if you're using `vice`.\n\n\n\u003c!-- Section link definitions --\u003e\n[introduction]: #introduction\n[examples]: #examples\n[usage]: #usage\n[contributing]: #contributing\n\n\u003c!-- Other links --\u003e\n[go]: https://golang.org\n\n[issues]: ./issues\n[bug]: ./issues/new?labels=bug\n[enhancement]: ./issues/new?labels=enhancement\n\n[me]: https://twitter.com/jrbowes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbowes%2Fvice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbowes%2Fvice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbowes%2Fvice/lists"}