{"id":39121787,"url":"https://github.com/gwaylib/errors","last_synced_at":"2026-01-17T20:38:19.639Z","repository":{"id":57481833,"uuid":"131114226","full_name":"gwaylib/errors","owner":"gwaylib","description":"go errors","archived":false,"fork":false,"pushed_at":"2025-04-30T08:14:58.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-01T07:47:39.499Z","etag":null,"topics":["caller","errors","rpc","stack"],"latest_commit_sha":null,"homepage":null,"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/gwaylib.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,"zenodo":null}},"created_at":"2018-04-26T07:05:33.000Z","updated_at":"2025-04-29T10:00:23.000Z","dependencies_parsed_at":"2024-03-02T21:28:49.473Z","dependency_job_id":"a377c360-e013-492f-978f-cb280986b330","html_url":"https://github.com/gwaylib/errors","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gwaylib/errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwaylib%2Ferrors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwaylib%2Ferrors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwaylib%2Ferrors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwaylib%2Ferrors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gwaylib","download_url":"https://codeload.github.com/gwaylib/errors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwaylib%2Ferrors/sbom","scorecard":{"id":450746,"data":{"date":"2025-08-11","repo":{"name":"github.com/gwaylib/errors","commit":"0f0fd0f7acabb2618d969927ad3435ebb5029bdb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/19 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":"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":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"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":"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":"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":10,"reason":"0 existing vulnerabilities detected","details":null,"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-19T08:08:22.764Z","repository_id":57481833,"created_at":"2025-08-19T08:08:22.764Z","updated_at":"2025-08-19T08:08:22.764Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28517825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"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":["caller","errors","rpc","stack"],"created_at":"2026-01-17T20:38:18.931Z","updated_at":"2026-01-17T20:38:19.619Z","avatar_url":"https://github.com/gwaylib.png","language":"Go","readme":"### README\n\nAn errors recorder package\n\nThis design supplements and implements the errors interface of golang,\nUsed to provide information such as the cause and file location of the error when it occurs, in order to restore the happened scene.\n\nDue to the large amount of data contained in this erroneous design, it is necessary to pay attention to the frequency of calls to avoid affecting system efficiency.\n\n* Example\n```text\npackage main\n\nimport \"github.com/gwaylib/errors\"\n\nfunc fn1(a int) error {\n    if a == 0 {\n        // return a common no data error\n        return errors.ErrNoData.As(a)\n    }\n    // other errors with fault position\n    return errors.New(\"not implements\").As(a)\n}\n\nfunc fn2(b int) error {\n    // call and set the error position, do nothing if 'fn1' return nil\n    return errors.As(fn1(b))\n}\n\nfunc main() {\n    err := fn2(2)\n    if err != nil {\n        // Attention, errors.ErrNoData == err may not necessarily hold, the Equal method should be used\n        if !errors.ErrNoData.Equal(err) {\n            panic(err)\n        }\n        fmt.Println(err)\n    }\n}\n```\n\n* Analyze errors position information of Error()\n```text\nOutput：\n[\"test\",[\"errors_test.go:90#errors.TestAs\"],[\"errors_test.go:95#errors.TestAs\",123,456]]\n\nDecode: \n[\"error code\", [\"runtime stack of New\"], [\"runtime stack of As\", \"args of As\"...]]\nthe first one is error code, the second is New, the others are As's called.\n```\n\n\n### Error handling suggestions\n* Prioritize handling errors before handling normal logic, where errors are less likely to be ignored and make the program more robust;\n* Unless the internal handling result of the error is specified, the error should be returned to the caller;\n* If there is no need to return to the caller, a log should be recorded instead of discarding the error\n* Normal logic should be avoided from being placed in 'if' as much as possible for easier indentation reading.\n```text\n// Suggest\nrows, err := db.Query(...)\nif err != nil{\n    return errors.As(err)\n}\ndefer rows.Close()\n...\n\n// Unsuggest\nrows, err := db.Query(...)\nif err == nil{\n    defer rows.Close()\n    // ...\n} else {\n    // handle error or not\n}\n```\n\n*) Define errors within a small scope, otherwise there is a risk of diffusion\n``` text\nfunc Get() (err error){\n    // Suggest\n    rows, err := db.Query(...)\n    if err != nil{\n        return errors.As(err)\n    }\n    defer rows.Close()\n  \n    if err := rows.Scan(...); err != nil{\n        // ...\n    }\n    ...\n}\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwaylib%2Ferrors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgwaylib%2Ferrors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwaylib%2Ferrors/lists"}