Categories: None [Edit]
faraday_error
# FaradayError
[![Gem Version](https://badge.fury.io/rb/faraday_error.svg)](https://badge.fury.io/rb/faraday_error)
A [Faraday](https://github.com/lostisland/faraday) middleware for adding request parameters to your exception tracker.
### Supports
- [Honeybadger](https://www.honeybadger.io/)
- [NewRelic](http://newrelic.com/)
- Your favorite thing, as soon as you make a pull request!
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'faraday_error'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install faraday_error
## Usage
Configure your Faraday connection to use this middleware. You can optionally specify a name; defaults to `faraday`. It is expected that you also use `Faraday::Response::RaiseError` somewhere in your stack.
```ruby
connection = Faraday.new(url: 'http://localhost:4567') do |faraday|
faraday.use FaradayError::Middleware, name: "example_request"
faraday.use Faraday::Response::RaiseError
faraday.adapter Faraday.default_adapter
end
```
And that's it. Make a request as you normally would.
```ruby
connection.post do |req|
req.url '/503'
req.headers['Content-Type'] = 'application/json'
req.body = JSON.generate(abc: "xyz")
end
```
If any request fails, Honeybadger's "context" for this error will include your request parameters. If sending JSON or `application/x-www-form-urlencoded`, these will be included in parsed form.
```json
{
"example_request": {
"method": "post",
"url": "http://localhost:4567/503",
"request_headers": {
"User-Agent": "Faraday v0.9.2",
"Content-Type": "application/json"
},
"body_length": 13,
"body": {
"abc": "xyz"
}
}
}
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, up...
Total
Ranking: 98,327 of 183,459
Downloads: 7,496
Daily
Ranking: 67,808 of 183,445
Downloads: 0
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|
Depends on
Rank | Downloads | Name |
---|---|---|
1 | 2,454,767,689 | bundler |
10 | 968,577,447 | rake |
21 | 887,406,729 | faraday |
25 | 824,841,076 | rspec |
124 | 285,004,939 | sinatra |
237 | 153,819,404 | newrelic_rpm |
1,116 | 31,705,260 | honeybadger |
Owners
# | Gravatar | Handle |
---|---|---|
1 | jelder |