{"id":23819769,"url":"https://github.com/markrosemaker/errpath","last_synced_at":"2026-04-14T14:32:46.695Z","repository":{"id":268961617,"uuid":"905999005","full_name":"MarkRosemaker/errpath","owner":"MarkRosemaker","description":"Utilities for creating and managing detailed error paths, allowing users to construct error messages that include the full path to the error. Useful when traversing complex data structures such as JSON or YAML files. Example: components.schemas[\"Pet\"].allOf[0]: invalid schema","archived":false,"fork":false,"pushed_at":"2024-12-23T11:05:32.000Z","size":182,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-28T04:36:36.777Z","etag":null,"topics":["error-handling","errors","golang","json","openapi","yaml"],"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/MarkRosemaker.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":"2024-12-20T00:18:01.000Z","updated_at":"2024-12-23T11:10:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"dd9f2c84-07cd-45c4-b015-4bf6be389d8e","html_url":"https://github.com/MarkRosemaker/errpath","commit_stats":null,"previous_names":["markrosemaker/errpath"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MarkRosemaker/errpath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkRosemaker%2Ferrpath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkRosemaker%2Ferrpath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkRosemaker%2Ferrpath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkRosemaker%2Ferrpath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkRosemaker","download_url":"https://codeload.github.com/MarkRosemaker/errpath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkRosemaker%2Ferrpath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008425,"owners_count":26084460,"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-10-11T02:00:06.511Z","response_time":55,"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","errors","golang","json","openapi","yaml"],"created_at":"2025-01-02T07:15:10.400Z","updated_at":"2025-10-11T19:35:18.373Z","avatar_url":"https://github.com/MarkRosemaker.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Error Path\n[![Go Reference](https://pkg.go.dev/badge/github.com/MarkRosemaker/errpath.svg)](https://pkg.go.dev/github.com/MarkRosemaker/errpath)\n[![Go Report Card](https://goreportcard.com/badge/github.com/MarkRosemaker/errpath)](https://goreportcard.com/report/github.com/MarkRosemaker/errpath)\n![Code Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"errpath logo: golang gopher determinedly walking through a blue and red maze\" src=logo.jpg width=300\u003e\n\u003c/p\u003e\n\nPackage errpath provides utilities for creating and managing detailed error paths.\nIt allows users to construct error messages that include the full path to the error,\nwhich can be particularly useful when traversing complex data structures such as JSON\nor YAML files.\n\nExample for an error in an OpenAPI: `components.schemas[\"Pet\"].allOf[0]: invalid schema`\n\nThe package defines several error types that can be used to represent different kinds\nof errors, such as missing required values, invalid values, and errors occurring at\nspecific fields, indices, or keys within a data structure. These error types implement\na chaining mechanism that builds a detailed error path.\n\n## Installation\n\nTo use this package, import it as follows:\n\n```go\nimport \"github.com/MarkRosemaker/errpath\"\n```\n\n## Creating Errors\n\nThere are several types of errors you can create with this package:\n\n### ErrRequired\n\nSignals that a required value is missing.\n\n```go\n\terr := \u0026errpath.ErrRequired{}\n```\n\n### ErrInvalid\n\nSignals that a value is invalid. You can optionally provide valid values and an explanatory message.\n\n```go\n\terr := \u0026errpath.ErrInvalid[string]{\n\t    Value:   \"invalid_value\",\n\t    Enum:    []string{\"valid1\", \"valid2\"},\n\t    Message: \"must be one of the valid values\",\n\t}\n```\n\n### ErrField\n\nRepresents an error that occurred in a specific field.\n\n```go\n\terr := \u0026errpath.ErrField{\n\t    Field: \"fieldName\",\n\t    Err:   \u0026errpath.ErrRequired{},\n\t}\n```\n\n### ErrIndex\n\nRepresents an error that occurred at a specific index in a slice.\n\n```go\n\terr := \u0026errpath.ErrIndex{\n\t    Index: 3,\n\t    Err:   \u0026errpath.ErrInvalid[int]{Value: 42},\n\t}\n```\n\n### ErrKey\n\nRepresents an error that occurred at a specific key in a map.\n\n```go\n\terr := \u0026errpath.ErrKey{\n\t    Key: \"keyName\",\n\t    Err: \u0026errpath.ErrRequired{},\n\t}\n```\n\n## Error Chaining\n\nErrors can be nested to form detailed error paths. For example:\n\n```go\n\terr := \u0026errpath.ErrField{\n\t    Field: \"foo\",\n\t    Err: \u0026errpath.ErrField{\n\t        Field: \"bar\",\n\t        Err: \u0026errpath.ErrKey{\n\t            Key: \"baz\",\n\t            Err: \u0026errpath.ErrField{\n\t                Field: \"qux\",\n\t                Err: \u0026errpath.ErrIndex{\n\t                    Index: 3,\n\t                    Err: \u0026errpath.ErrField{\n\t                        Field: \"quux\",\n\t                        Err: \u0026errpath.ErrInvalid[string]{\n\t                            Value: \"corge\",\n\t                        },\n\t                    },\n\t                },\n\t            },\n\t        },\n\t    },\n\t}\n```\n\nThis will produce an error message like:\n\n```\n\tfoo.bar[\"baz\"].qux[3].quux (\"corge\") is invalid\n```\n\n## Additional Information\n\n- [**Go Reference**](https://pkg.go.dev/github.com/MarkRosemaker/errpath): The Go reference documentation for the errpath package.\n- [**Go Report Card**](https://goreportcard.com/report/github.com/MarkRosemaker/errpath): Check the code quality report.\n\n## Contributing\n\nIf you have any contributions to make, please submit a pull request or open an issue on the [GitHub repository](https://github.com/MarkRosemaker/errpath).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkrosemaker%2Ferrpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkrosemaker%2Ferrpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkrosemaker%2Ferrpath/lists"}