{"id":13412761,"url":"https://github.com/PumpkinSeed/errors","last_synced_at":"2025-03-14T18:32:10.844Z","repository":{"id":57510082,"uuid":"232660899","full_name":"PumpkinSeed/errors","owner":"PumpkinSeed","description":"Simple and efficient error package ","archived":false,"fork":false,"pushed_at":"2022-03-31T13:23:10.000Z","size":18,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T20:51:26.747Z","etag":null,"topics":[],"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/PumpkinSeed.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":"2020-01-08T21:12:51.000Z","updated_at":"2023-08-29T00:07:32.000Z","dependencies_parsed_at":"2022-09-26T17:50:50.851Z","dependency_job_id":null,"html_url":"https://github.com/PumpkinSeed/errors","commit_stats":null,"previous_names":["pumpkinseed/error"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Ferrors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Ferrors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Ferrors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Ferrors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PumpkinSeed","download_url":"https://codeload.github.com/PumpkinSeed/errors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221495311,"owners_count":16832457,"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":[],"created_at":"2024-07-30T20:01:28.860Z","updated_at":"2024-10-26T04:31:08.090Z","avatar_url":"https://github.com/PumpkinSeed.png","language":"Go","readme":"[![Build Status](https://travis-ci.com/PumpkinSeed/errors.svg?branch=master)](https://travis-ci.com/PumpkinSeed/errors)\n[![Go Report Card](https://goreportcard.com/badge/github.com/PumpkinSeed/errors)](https://goreportcard.com/report/github.com/PumpkinSeed/errors)\n[![Documentation](https://godoc.org/github.com/PumpkinSeed/errors?status.svg)](http://godoc.org/github.com/PumpkinSeed/errors)\n[![Gocover](http://gocover.io/_badge/github.com/PumpkinSeed/errors)](http://gocover.io/github.com/PumpkinSeed/errors)\n\n# Errors\n\nSimple error package for Go with minimal allocation and high performance. Optimized to keep error on function stack.\n\n### Motivation\n\nI found out that the available error packages too complex for the simple purpose or not achieve the simple goal.\n\n### Purpose \u0026 Goal\n\nMaintain an error chain (some kind of list of errors), and let the system to check whether the error's type caused the actual error or not.\n\n### Usage\n\n```go\npackage main\n\nimport (\n    stderrors \"errors\"\n\n    \"github.com/PumpkinSeed/errors\"\n)\n\nvar ErrGlobal = errors.New(\"global err\")\nvar ErrGlobal2 = errors.New(\"global err 2\")\nvar ErrNotUsed = errors.New(\"not used err\")\n\nfunc main() {\n    err := f3()\n    \n    stderrors.Is(err, ErrGlobal) // true\n    stderrors.Is(err, ErrGlobal2) // true\n    stderrors.Is(err, ErrNotUsed) // false\n\n    println(err.Error()) // \"global err 2: global err: string1\"\n}\n\nfunc f1() error {\n    return errors.New(\"string1\")\n}\n\nfunc f2() error {\n    return errors.Wrap(f1(), ErrGlobal)\n}\n\nfunc f3() error {\n    return errors.Wrap(f2(), ErrGlobal2)\n}\n```  \n","funding_links":[],"categories":["Relational Databases","Error Handling","错误处理","错误处理`go 语言错误处理库`"],"sub_categories":["Search and Analytic Databases","检索及分析资料库","SQL 查询语句构建库","Advanced Console UIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPumpkinSeed%2Ferrors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPumpkinSeed%2Ferrors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPumpkinSeed%2Ferrors/lists"}