{"id":28932979,"url":"https://github.com/davyjoneslocker/party_foul","last_synced_at":"2025-10-08T17:05:25.559Z","repository":{"id":6317634,"uuid":"7552641","full_name":"DavyJonesLocker/party_foul","owner":"DavyJonesLocker","description":"Use GitHub to track your application errors!","archived":false,"fork":false,"pushed_at":"2018-03-12T13:48:53.000Z","size":300,"stargazers_count":517,"open_issues_count":16,"forks_count":47,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-06-20T15:11:07.554Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://dockyard.com","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gutomaia/pyNES","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavyJonesLocker.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-11T02:20:25.000Z","updated_at":"2024-10-22T22:37:01.000Z","dependencies_parsed_at":"2022-07-09T16:16:52.859Z","dependency_job_id":null,"html_url":"https://github.com/DavyJonesLocker/party_foul","commit_stats":null,"previous_names":["dockyard/party_foul"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/DavyJonesLocker/party_foul","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fparty_foul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fparty_foul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fparty_foul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fparty_foul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavyJonesLocker","download_url":"https://codeload.github.com/DavyJonesLocker/party_foul/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fparty_foul/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261330134,"owners_count":23142484,"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":"2025-06-22T17:10:27.968Z","updated_at":"2025-10-08T17:05:25.552Z","avatar_url":"https://github.com/DavyJonesLocker.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PartyFoul #\n\n[![Build Status](https://secure.travis-ci.org/DockYard/party_foul.svg?branch=master)](http://travis-ci.org/DockYard/party_foul)\n[![Dependency Status](https://gemnasium.com/dockyard/party_foul.svg?travis)](https://gemnasium.com/dockyard/party_foul)\n[![Code Climate](https://codeclimate.com/github/dockyard/party_foul.svg)](https://codeclimate.com/github/dockyard/party_foul)\n\nRails exceptions automatically opened as issues on GitHub\n\n## Looking for help? ##\n\nIf it is a bug [please open an issue on\nGitHub](https://github.com/dockyard/party_foul/issues).\n\n## About ##\n\n`PartyFoul` captures exceptions in your application and does the\nfollowing:\n\n1. Attempt to find a matching issue in your GitHub repo\n2. If no matching issue is found, a new issue is created with a\n   unique title, session information, and stack trace. The issue is\ntagged as a `bug`. A new comment is added with relevant data on the\napplication state.\n3. If an open issue is found, the occurrence count and time stamp is\n   updated. A new comment is added with relevant data on the\napplication state.\n4. If a closed issue is found, the occurrence count and time stamp is\n   updated. The issue is reopened and a `regression` tag is\nadded. A new comment is added with relevant data on the\napplication state.\n5. If the issue is marked as `wontfix` the issue is not updated nor is\n   a new issue created. No comments are added.\n\n## Installation ##\n\n**Note** We highly recommend that you create a new GitHub account that is\na collaborator on your repository. Use this new account's credentials\nfor the installation below. If you use your own account you will\nnot receive emails when issues are created, updated, reopened, etc...\nbecause all of the work is done as your account.\n\nIn your Gemfile add the following:\n\n```ruby\ngem 'party_foul'\n```\n\n### Rails ###\nIf you are using Rails you can run the install generator.\n\n```\nrails g party_foul:install\n```\n\nThis prompts you for the GitHub credentials of the account that is\nopening the issues. The OAuth token for that account is stored\nin `config/initializers/party_foul.rb`. You may want to remove the token\nstring and store in an environment variable. It is best not to store the\ntoken in version control.\n\nAdd as the very last middleware in your production `Rack` stack in `config/environments/production.rb`\n\n```ruby\nconfig.middleware.use('PartyFoul::Middleware')\n```\n### Other ###\n\nYou need to initialize `PartyFoul`, use the following:\n\n```ruby\nPartyFoul.configure do |config|\n  # The collection of exceptions PartyFoul should not be allowed to handle\n  # The constants here *must* be represented as strings\n  config.blacklisted_exceptions = ['ActiveRecord::RecordNotFound', 'ActionController::RoutingError']\n\n  # The OAuth token for the account that is opening the issues on GitHub\n  config.oauth_token            = 'abcdefgh1234567890'\n\n  # The API endpoint for GitHub. Unless you are hosting a private\n  # instance of Enterprise GitHub you do not need to include this\n  config.api_endpoint           = 'https://api.github.com'\n\n  # The Web URL for GitHub. Unless you are hosting a private\n  # instance of Enterprise GitHub you do not need to include this\n  config.web_url                = 'https://github.com'\n\n  # The organization or user that owns the target repository\n  config.owner                  = 'owner_name'\n\n  # The repository for this application\n  config.repo                   = 'repo_name'\n\n  # The branch for your deployed code\n  # config.branch               = 'master'\n\n  # Additional labels to add to issues created\n  # config.additional_labels    = ['production']\n  # or\n  # config.additional_labels    = Proc.new do |exception, env|\n  #   []\n  # end\n\n  # Limit the number of comments per issue\n  # config.comment_limit        = 10\n\n  # Setting your title prefix can help with\n  # distinguising the issue between environments\n  # config.title_prefix         = Rails.env\nend\n```\n\nYou can\n[create an OAuth token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/)\nor generate an OAuth token via the\n[OAuth Authorizations API](http://developer.github.com/v3/oauth/#oauth-authorizations-api) with cURL:\n\n```bash\ncurl -u \u003cgithub_login\u003e -i -d \"{ \\\"scopes\\\": [\\\"repo\\\"], \\\"note\\\":[\\\"Test\\\"] }\" \\\nhttps://api.github.com/authorizations\n```\n\n## Customization ##\n\n### Labels ###\n\nYou can specify an additional array of labels that will be applied to the issues PartyFoul creates.\n\n```ruby\nPartyFoul.configure do |config|\n  config.additional_labels = ['front-end']\nend\n```\n\nYou can also provide a Proc that is passed the exception and the environment.\n\n```ruby\nPartyFoul.configure do |config|\n  config.additional_labels = Proc.new do |exception, env|\n    labels = if env[\"HTTP_HOST\"] =~ /beta\\./\n      ['beta']\n    else\n      ['production']\n    end\n    if exception.message =~ /PG::Error/\n      labels \u003c\u003c 'database'\n    end\n    labels\n  end\nend\n```\n\n### Background Processing ###\n\nYou can specify the adapter with which the exceptions should be\nhandled. By default, PartyFoul includes the\n[`PartyFoul::Processors::Sync`](https://github.com/dockyard/party_foul/tree/master/lib/party_foul/processors/sync.rb)\nwhich handles the exception synchronously. To use your own adapter,\ninclude the following in your `PartyFoul.configure` block:\n\n```ruby\nPartyFoul.configure do |config|\n  config.processor = PartyFoul::Processors::MyBackgroundProcessor\nend\n\nclass PartyFoul::Processors::MyBackgroundProcessor\n  def self.handle(exception, env)\n    # Enqueue the exception, then in your worker, call\n    # PartyFoul::ExceptionHandler.new(exception, env).run\n  end\nend\n\n```\n\n`PartyFoul` comes with the following background processing adapters:\n\n* [PartyFoul::Processors::Sidekiq](https://github.com/dockyard/party_foul/blob/master/lib/party_foul/processors/sidekiq.rb)\n* [PartyFoul::Processors::Resque](https://github.com/dockyard/party_foul/blob/master/lib/party_foul/processors/resque.rb)\n* [PartyFoul::Processors::DelayedJob](https://github.com/dockyard/party_foul/blob/master/lib/party_foul/processors/delayed_job.rb)\n\nThese adapters are not loaded by default. You must explicitly require if\nyou want to use:\n\n```ruby\nrequire 'party_foul/processors/sidekiq'\n\nPartyFoul.configure do |config|\n  config.processor = PartyFoul::Processors::Sidekiq\nend\n```\n\n### Limiting Comments\n\nYou can specify a limit on the number of comments added to each issue. The main issue will still be updated\nwith a count and time for each occurrence, regardless of the limit.\n\n```ruby\nPartyFoul.configure do |config|\n  config.comment_limit = 10\nend\n```\n\n## Tracking errors outside of an HTTP request\n\nYou may want to track errors outside of a regular HTTP stack. In that\ncase you will need to make sure of the\n`PartyFoul::RacklessExceptionHandler`.\n\nThe code that you want to handle should be wrapped like so:\n\n```ruby\nbegin\n  ... # some code that might raise an error\nrescue =\u003e error\n  PartyFoul::RacklessExceptionHandler.handle(error, class: class_name, method: method_name, params: message)\n  raise error\nend\n```\n\n### Tracking errors in a Sidekiq worker\nIn order to use PartyFoul for exception handling with Sidekiq you will need to create an initializer with some middleware configuration. The following example is based on using [Sidekiq with another exception notifier server](https://github.com/bugsnag/bugsnag-ruby/blob/master/lib/bugsnag/sidekiq.rb).\n\nFile: config/initializers/partyfoul_sidekiq.rb\n\n```ruby\nmodule PartyFoul\n  class Sidekiq\n    def call(worker, msg, queue)\n      begin\n        yield\n      rescue =\u003e error\n        PartyFoul::RacklessExceptionHandler.handle(error, {class: worker.class.name, method: queue, params: msg})\n        raise error\n      end\n    end\n  end\nend\n\n::Sidekiq.configure_server do |config|\n  config.server_middleware do |chain|\n    chain.add ::PartyFoul::Sidekiq\n  end\nend\n```\n\nThis will pass the worker class name and queue as well as all worker-related parameters off to PartyFoul before passing on the exception.\n\n## Authors ##\n\n* [Brian Cardarella](http://twitter.com/bcardarella)\n* [Dan McClain](http://twitter.com/_danmcclain)\n\n[We are very thankful for the many contributors](https://github.com/dockyard/party_foul/graphs/contributors)\n\n## Versioning ##\n\nThis gem follows [Semantic Versioning](http://semver.org)\n\n## Want to help? ##\n\nPlease do! We are always looking to improve this gem. Please see our\n[Contribution Guidelines](https://github.com/dockyard/party_foul/blob/master/CONTRIBUTING.md)\non how to properly submit issues and pull requests.\n\n## Legal ##\n\n[DockYard](http://dockyard.com), LLC \u0026copy; 2013\n\n[@dockyard](http://twitter.com/dockyard)\n\n[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavyjoneslocker%2Fparty_foul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavyjoneslocker%2Fparty_foul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavyjoneslocker%2Fparty_foul/lists"}