{"id":38247134,"url":"https://github.com/rtkym/errs-go","last_synced_at":"2026-01-17T01:24:31.536Z","repository":{"id":61627650,"uuid":"529179474","full_name":"rtkym/errs-go","owner":"rtkym","description":"errs-go is simple error with stack trace and key-value attribute.","archived":false,"fork":false,"pushed_at":"2022-10-20T10:40:47.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T00:38:52.992Z","etag":null,"topics":["error","errwrap","golang"],"latest_commit_sha":null,"homepage":"","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/rtkym.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":"2022-08-26T08:36:28.000Z","updated_at":"2024-06-20T00:38:52.993Z","dependencies_parsed_at":"2023-01-20T07:01:18.491Z","dependency_job_id":null,"html_url":"https://github.com/rtkym/errs-go","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rtkym/errs-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtkym%2Ferrs-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtkym%2Ferrs-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtkym%2Ferrs-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtkym%2Ferrs-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtkym","download_url":"https://codeload.github.com/rtkym/errs-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtkym%2Ferrs-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28491432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T00:50:05.742Z","status":"ssl_error","status_checked_at":"2026-01-17T00:43:11.982Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","errwrap","golang"],"created_at":"2026-01-17T01:24:31.261Z","updated_at":"2026-01-17T01:24:31.515Z","avatar_url":"https://github.com/rtkym.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# errs-go\nerrs-go is simple error with stack trace and key-value attribute.\n\n## Usage\n### Create\nnew error instance\n```go\nfunc someFunction() error {\n    err := errs.New(\"parameter error\")\n}\n```\nwith value\n```go\nfunc someFunction() error {\n    err := errs.New(\"parameter error\").With(\"key\", \"value\")\n}\n```\nwrapping\n```go\nfunc someFunction() error {\n    err := errs.Wrap(errors.New(\"original error\"))\n}\n```\n### Template\nDeclare the definition of error\n```go\nconst (\n    ErrNoSession    errs.StringError = \"ErrNoSession\"\n    ErrRetryTimeout errs.StringError = \"ErrRetryTimeout\"\n)\n\nfunc someFunction1() error {\n    session := getSession()\n    if session != nil {\n        return ErrNoSession.New()\n    }\n}\n\nfunc someFunction2() error {\n    conn, err := connect()\n    if err != nil {\n        return ErrRetryTimeout.Wrap(err)\n    }\n}\n```\n### StackTrace\nSource:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/goccy/go-json\"\n\n\t\"github.com/rtkym/errs-go\"\n)\n\nfunc something(value string) error {\n\treturn errs.New(\"somthing error\").With(\"key\", value)\n}\n\nfunc main() {\n\tif err := something(\"hoge\"); err != nil {\n\t\tb, _ := json.Marshal(err)\n\t\tfmt.Printf(\"%s\\n\", err)\n\t\tfmt.Printf(\"%+v\\n\", err)\n\t\tfmt.Println(string(b))\n\t}\n}\n\n```\nOutput: %s\n```\nsomthing error\n```\nOutput: %+v\n```\nsomthing error\nvalues={\"key\":\"hoge\"}\nmain.something\n        ./main.go:11\nmain.main\n        ./main.go:15\nruntime.main\n        runtime/proc.go:250\nruntime.goexit\n        runtime/asm_amd64.s:1571\n\n```\nOutput: JSON\n```json\n{\n    \"message\": \"somthing error\",\n    \"values\": {\n        \"key\": \"hoge\"\n    },\n    \"stackTrace\": [\n        {\n            \"func\": \"main.something\",\n            \"file\": \"./main.go\",\n            \"line\": 11\n        },\n        {\n            \"func\": \"main.main\",\n            \"file\": \"./main.go\",\n            \"line\": 15\n        },\n        {\n            \"func\": \"runtime.main\",\n            \"file\": \"runtime/proc.go\",\n            \"line\": 250\n        },\n        {\n            \"func\": \"runtime.goexit\",\n            \"file\": \"runtime/asm_amd64.s\",\n            \"line\": 1571\n        }\n    ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtkym%2Ferrs-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtkym%2Ferrs-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtkym%2Ferrs-go/lists"}