{"id":15064556,"url":"https://github.com/vadimstroganov/error_responder","last_synced_at":"2026-02-18T11:33:50.111Z","repository":{"id":56844772,"uuid":"98986105","full_name":"vadimstroganov/error_responder","owner":"vadimstroganov","description":"Error responder for Rails API","archived":false,"fork":false,"pushed_at":"2017-08-03T13:39:48.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T10:32:43.317Z","etag":null,"topics":["error-handler","error-handling","rails","rails-api"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/vadimstroganov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-01T09:49:42.000Z","updated_at":"2017-08-01T10:47:53.000Z","dependencies_parsed_at":"2022-08-26T13:23:10.556Z","dependency_job_id":null,"html_url":"https://github.com/vadimstroganov/error_responder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vadimstroganov/error_responder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimstroganov%2Ferror_responder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimstroganov%2Ferror_responder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimstroganov%2Ferror_responder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimstroganov%2Ferror_responder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vadimstroganov","download_url":"https://codeload.github.com/vadimstroganov/error_responder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimstroganov%2Ferror_responder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000773,"owners_count":26082906,"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-09T02:00:07.460Z","response_time":59,"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-handler","error-handling","rails","rails-api"],"created_at":"2024-09-25T00:20:29.570Z","updated_at":"2025-10-12T03:02:47.804Z","avatar_url":"https://github.com/vadimstroganov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/error_responder.svg)](https://badge.fury.io/rb/error_responder)\n\n### Error responder for Rails API \n#### Generator of standard HTTP responses and error serializer for models.\n\n### Getting Started\n\nAdd it to your Gemfile:\n\n```ruby\ngem 'error_responder'\n```\n\n#### 1) Generate standard HTTP responses\n\n```ruby\nerr_respond(err_code, key: nil, message: nil)\n```\n\n\n#### 2) Generate responce with model validation errors\n\n```ruby\nserialize_errors(errors, options = {})\n```\n\n### Usage example\n\n#### 1) Generate standard HTTP responses\n\n```ruby\nerr_respond 404\n```\n\nWill be generated:\n\n```json\n{\n    \"status\": \"404\",\n    \"info\": \"Not Found\",\n    \"errors\": {}\n}\n```\n\nYou can pass a custom error message:\n```ruby\nerr_respond 404, key: 'user', message: 'Not present in database.'\n```\n\nWill be generated:\n\n```json\n{\n    \"status\": \"404\",\n    \"info\": \"Not Found\",\n    \"errors\": {\n        \"user\": \"Not present in database.\"\n    }\n}\n```\n\n#### 2) Generate responce with model validation errors\n\n```ruby\n@user = User.new(user_params)\nif @user.save\n  # ...\nelse\n  serialize_errors(@user.errors)\nend\n```\n\nWill be generated (model errors):\n\n```json\n{\n    \"status\": 409,\n    \"info\": \"Conflict\",\n    \"errors\": {\n        \"username\": \"Username can't be blank.\",\n        \"first_name\": \"First name can't be blank.\",\n        \"last_name\": \"Last name can't be blank.\"\n    }\n}\n```\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimstroganov%2Ferror_responder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvadimstroganov%2Ferror_responder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimstroganov%2Ferror_responder/lists"}