{"id":16843668,"url":"https://github.com/brianvoe/uhoh","last_synced_at":"2026-03-11T15:36:41.661Z","repository":{"id":57636757,"uuid":"427165286","full_name":"brianvoe/uhoh","owner":"brianvoe","description":"Golang advanced error usage with stack tracing","archived":false,"fork":false,"pushed_at":"2022-01-31T21:17:10.000Z","size":25,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T05:53:40.576Z","etag":null,"topics":["error","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brianvoe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-11T22:49:42.000Z","updated_at":"2023-10-03T10:25:53.000Z","dependencies_parsed_at":"2022-08-30T09:40:57.051Z","dependency_job_id":null,"html_url":"https://github.com/brianvoe/uhoh","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/brianvoe/uhoh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianvoe%2Fuhoh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianvoe%2Fuhoh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianvoe%2Fuhoh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianvoe%2Fuhoh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianvoe","download_url":"https://codeload.github.com/brianvoe/uhoh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianvoe%2Fuhoh/sbom","scorecard":{"id":253511,"data":{"date":"2025-08-11","repo":{"name":"github.com/brianvoe/uhoh","commit":"2598fabdf446b9d03db20259839c39a838d54674"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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-17T09:01:49.967Z","repository_id":57636757,"created_at":"2025-08-17T09:01:49.967Z","updated_at":"2025-08-17T09:01:49.967Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30386155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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","golang","stacktrace"],"created_at":"2024-10-13T12:52:51.755Z","updated_at":"2026-03-11T15:36:41.629Z","avatar_url":"https://github.com/brianvoe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UhOh\n\nGolang advanced error usage with stack tracing\n\nuhoh consists of a few parts:\n\n- Original error\n- Description of error\n- Type error\n- Stack trace\n  - File\n  - Function\n  - Line\n- Date\n\n## Simple Usage\n\nUhoh can be as descriptive or as simple as you want. The only thing it requires is an initial error.\n\n```go\nimport \"github.com/brianvoe/uhoh\"\n\n// Create new uhoh error\nerr := uhoh.New(errors.New(\"original error\"))\nfmt.Println(err.Error())\n\n// Output:\n// 2021-09-12T01:20:30Z | original error\n```\n\n## Advanced Usage\n\nLets see what uhoh can do with a more data and output values.\n\n```go\n// Create error\nerr := New(errors.New(\"original error\"))\nerr.SetDescribe(errors.New(\"describe error\"))\nerr.SetType(uhoh.ErrGeneral)\n\n// Output info\nfmt.Println(err.Error())\nfmt.Println(err.Stack)\n\n// Output:\n// 2021-09-12T01:20:30Z | general error | original error | describe error\n// [{uhoh_test.go Example 16} {run_example.go runExample 64} {example.go runExamples 44}]\n```\n\n## Using With Str\n\nIn order to simplify the use of uhoh, uhoh has Str equivalents for set methods so you dont have to always initiate an errors.New().\n\n```go\n// Create error\nerr := uhoh.NewStr(\"original error\")\nerr.SetDescribeStr(\"describe error\")\nerr.SetTypeStr(\"general error\")\n\n// Output info\nfmt.Println(err.Error())\nfmt.Println(err.Stack)\n\n// Output:\n// 2021-09-12T01:20:30Z | general error | original error | describe error\n// [{uhoh_test.go Example 16} {run_example.go runExample 64} {example.go runExamples 44}]\n```\n\n## Real World Usage\n\nTo give you a better understanding of how uhoh works, let's look at a real world example\n\n```go\nvar fileErrType = errors.New(\"file error\")\n\n_, err := os.Open(\"/test.txt\")\nif err != nil {\n    uhohErr := uhoh.New(err)\n    uhohErr.SetDescribe(errors.New(\"Failed to open file. Please check settings.\"))\n    uhohErr.SetType(fileErrType)\n\n    // Lets log out all the uhoh fields\n    log.Printf(\"%s\", uhohErr.ToJson())\n}\n```\n\n```json\n{\n  \"original\": \"open /test.txt: no such file or directory\",\n  \"describe\": \"Failed to open file. Please check settings.\",\n  \"type\": \"file error\",\n  \"stack\": [\n    { \"file\": \"uhoh_test.go\", \"function\": \"Example_realWorld\", \"line\": 40 },\n    { \"file\": \"run_example.go\", \"function\": \"runExample\", \"line\": 64 },\n    { \"file\": \"example.go\", \"function\": \"runExamples\", \"line\": 44 }\n  ],\n  \"date\": \"2021-09-12T01:20:30Z\"\n}\n```\n\n## Type for Is checking\n\nYou may want to check if an error is of a certain type.\nUhoh has a list of types that you can use to check if an error is of a certain type.\nOtherwise you can set your own internal types.\n\n```go\nvar (\n    ErrValidation = errors.New(\"validation error\")\n    ErrFile       = errors.New(\"file error\")\n    ErrNetwork    = errors.New(\"network error\")\n)\n\nfunc main() {\n  err := Validate()\n  if err != nil {\n      if uhoh.Is(err, ErrValidation) {\n          // do something\n      }\n  }\n}\n\nfunc Validate() error {\n  return uhoh.New(errors.New(\"field is invalid\")).SetType(ErrValidation)\n}\n\n// Output json of everything\nlog.Println(err.ToJson())\n```\n\n## Custom Error\n\nYou can create your own Error return string.\nBy default, uhoh will return with format: date | type error | original error | describe error\n\n```go\n// Create your own error return value\ncustomError := func(err *Err) string {\n  return err.Original.Error() + \": \" + err.Describe.Error()\n}\n\n// Set it to your function\nSetDefaultErrorFormatter(customError)\n\noriginalErr := errors.New(\"original error\")\ndescribeErr := errors.New(\"describe error\")\n\nerr := New(originalErr).SetDescribe(describeErr).SetType(uhoh.ErrGeneral)\nfmt.Printf(\"%s\", err.Error())\n\n// Output:\n// original error: describe error\n```\n\n## Set Date\n\nThe date is set to the current date and time. If you want to set the date to a specific date, you can use the `SetDate` function.\n\n```go\n// Errors\noriginalErr := errors.New(\"original error\")\n\nerr := New(originalErr)\nerr.SetDate(time.Date(2021, time.Month(9), 12, 1, 20, 30, 0, time.UTC))\nfmt.Println(err.Date)\n\n// Output:\n// 2021-09-12 01:20:30 +0000 UTC\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianvoe%2Fuhoh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianvoe%2Fuhoh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianvoe%2Fuhoh/lists"}