{"id":19435413,"url":"https://github.com/enzious/actix-web-thiserror","last_synced_at":"2025-06-21T21:41:31.900Z","repository":{"id":154079450,"uuid":"631444612","full_name":"enzious/actix-web-thiserror","owner":"enzious","description":"A crate that extends the thiserror crate functionality to automatically return a proper actix-web response.","archived":false,"fork":false,"pushed_at":"2024-06-16T19:59:46.000Z","size":39,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T19:36:20.460Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/enzious.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-04-23T03:24:44.000Z","updated_at":"2024-08-29T07:53:49.000Z","dependencies_parsed_at":"2024-06-16T20:55:44.450Z","dependency_job_id":null,"html_url":"https://github.com/enzious/actix-web-thiserror","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/enzious/actix-web-thiserror","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzious%2Factix-web-thiserror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzious%2Factix-web-thiserror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzious%2Factix-web-thiserror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzious%2Factix-web-thiserror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enzious","download_url":"https://codeload.github.com/enzious/actix-web-thiserror/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzious%2Factix-web-thiserror/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261199991,"owners_count":23123917,"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","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":[],"created_at":"2024-11-10T15:06:14.492Z","updated_at":"2025-06-21T21:41:26.883Z","avatar_url":"https://github.com/enzious.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# actix-web-thiserror\n\n[![License](https://img.shields.io/github/license/enzious/actix-web-thiserror)](https://github.com/enzious/actix-web-thiserror/blob/master/LICENSE.md)\n[![Contributors](https://img.shields.io/github/contributors/enzious/actix-web-thiserror)](https://github.com/enzious/actix-web-thiserror/graphs/contributors)\n[![GitHub Repo stars](https://img.shields.io/github/stars/enzious/actix-web-thiserror?style=social)](https://github.com/enzious/actix-web-thiserror)\n[![crates.io](https://img.shields.io/crates/v/actix-web-thiserror.svg)](https://crates.io/crates/actix-web-thiserror)\n\nA crate that extends the [thiserror] crate functionality to automatically\nreturn a proper [actix-web] response.\n\n## Documentation\n\n- [API Documentation](https://docs.rs/actix-web-thiserror)\n\n## Error definition\n```rust\nuse actix_web_thiserror::ResponseError;\nuse thiserror::Error;\n\n#[derive(Debug, Error, ResponseError)]\npub enum Base64ImageError {\n  #[response(reason = \"INVALID_IMAGE_FORMAT\")]\n  #[error(\"invalid image format\")]\n  InvalidImageFormat,\n  #[response(reason = \"INVALID_STRING\")]\n  #[error(\"invalid string\")]\n  InvalidString,\n}\n```\n\n## Error implementation\n```rust\npub async fn error_test() -\u003e Result\u003cHttpResponse, Error\u003e {\n  Err(Base64ImageError::InvalidImageFormat)?\n}\n```\n\n## Error response\n\nThe `reason` is a string that may be given to the client in some form to explain\nthe error, if appropriate. Here it is as an enum that can be localized.\n\n**Note:** This response has been formatted by a [`ResponseTransform`][response_transform]. To specify a custom ResponseTransform, implement [`ResponseTransform`][response_transform] and add `#[response(transform = custom)]` under your derive.\n\n```\n{\n    \"result\": 0,\n    \"reason\": \"INVALID_IMAGE_FORMAT\"\n}\n```\n\n## Error logging\n\nThe error text automatically prints to the log when the error is returned out\nthrough a http response.\n\n```\nApr 23 02:19:35.211 ERROR Response error: invalid image format\n    Base64ImageError(InvalidImageFormat), place: example/src/handler.rs:5 example::handler\n```\n\n[thiserror]: https://docs.rs/thiserror\n[actix-web]: https://docs.rs/actix-web\n[response_transform]: crate::ResponseTransform\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenzious%2Factix-web-thiserror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenzious%2Factix-web-thiserror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenzious%2Factix-web-thiserror/lists"}