{"id":21423207,"url":"https://github.com/rahugg/go-stacktrace","last_synced_at":"2026-02-18T07:32:04.426Z","repository":{"id":264180713,"uuid":"892589674","full_name":"Rahugg/go-stacktrace","owner":"Rahugg","description":"go-stacktrace is a lightweight and customizable Go package for enhanced error handling and tracing. It wraps errors with additional context, user-friendly messages, and detailed stack traces, making it easier to diagnose and debug issues in your Go applications.","archived":false,"fork":false,"pushed_at":"2024-11-22T14:49:21.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T15:51:14.367Z","etag":null,"topics":["error-handling","error-traces","golang","golang-package","golang-tools","lightweight","traceroute","tracing-library","zero-dependency"],"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/Rahugg.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":"2024-11-22T12:00:19.000Z","updated_at":"2024-11-23T18:19:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2ee6822-ffbf-4395-8be2-184148312c7d","html_url":"https://github.com/Rahugg/go-stacktrace","commit_stats":null,"previous_names":["rahugg/go-stacktrace"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Rahugg/go-stacktrace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahugg%2Fgo-stacktrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahugg%2Fgo-stacktrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahugg%2Fgo-stacktrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahugg%2Fgo-stacktrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rahugg","download_url":"https://codeload.github.com/Rahugg/go-stacktrace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahugg%2Fgo-stacktrace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273782459,"owners_count":25167134,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-handling","error-traces","golang","golang-package","golang-tools","lightweight","traceroute","tracing-library","zero-dependency"],"created_at":"2024-11-22T21:15:06.635Z","updated_at":"2025-10-19T17:28:36.225Z","avatar_url":"https://github.com/Rahugg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-stacktrace\n\n`go-stacktrace` is a robust Go package for enhanced error handling, providing stack traces, error wrapping, and user-friendly error messages with optional color formatting.\n\n## Features\n\n- 🔍 Detailed stack traces for improved debugging\n- 📝 Custom user messages and payload support\n- 🎨 Colorized error output (configurable)\n- 🔄 Error wrapping with context preservation\n- 🪶 Lightweight with zero external dependencies\n- 🧪 Comprehensive test coverage\n\n## Installation\n\n```bash\ngo get github.com/Rahugg/go-stacktrace\n```\n\n## Usage\n\n### Basic Error Wrapping\n\n```go\nimport \"github.com/Rahugg/go-stacktrace/errorhandler\"\n\nfunc main() {\n    err := someFunction()\n    if err != nil {\n        wrappedErr := errorhandler.WrapError(\n            err,\n            \"operation-failed\",  // payload\n            \"Failed to process request\"  // user message\n        )\n        fmt.Println(errorhandler.FailOnError(wrappedErr))\n    }\n}\n```\n\n### Controlling Color Output\n\n```go\n// Disable colored output\nerrorhandler.SetEnableColors(false)\n\n// Enable colored output (default)\nerrorhandler.SetEnableColors(true)\n```\n\n### Error Information\n\nThe wrapped error includes:\n- Original error message\n- User-friendly message\n- Custom payload (optional)\n- Stack trace\n- Color-coded output (optional)\n\n## Example Output\n\n```\nPayload: operation-failed\nError Details\nOriginal Error: file not found\nUser Message: Failed to process request\n\nStack Trace\nmain.someFunction\n    /path/to/file.go:25\nmain.main\n    /path/to/main.go:12\n```\n\n## Features in Detail\n\n### TracedError Structure\n```go\ntype TracedError struct {\n    OriginalError error\n    UserMessage   string\n    Payload       string\n    StackTrace    []uintptr\n}\n```\n\n### Available Colors\n- Red: Error messages\n- Green: User messages\n- Yellow: Payload information\n- Blue: Function names in stack trace\n- Magenta: Stack trace headers\n- Cyan: Section headers\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\nOr DM me.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Project Structure\n```\n.\n├── errorhandler\n│   ├── colors.go          # Color constants\n│   ├── errorhandler.go    # Core functionality\n│   └── errorhandler_test.go # Test suite\n├── example\n│   └── main.go           # Usage examples\n├── go.mod\n├── go.yml\n└── README.md\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahugg%2Fgo-stacktrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahugg%2Fgo-stacktrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahugg%2Fgo-stacktrace/lists"}