https://github.com/BetterErrors/better_errors
Better error page for Rack apps
https://github.com/BetterErrors/better_errors
Keywords from Contributors
activerecord mvc activejob rubygem rspec sinatra rack crash-reporting rubocop error-monitoring
Last synced: about 21 hours ago
JSON representation
Repository metadata
Better error page for Rack apps
- Host: GitHub
- URL: https://github.com/BetterErrors/better_errors
- Owner: BetterErrors
- License: mit
- Created: 2012-12-08T11:02:18.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T08:00:44.000Z (over 1 year ago)
- Last Synced: 2026-02-26T20:12:16.681Z (5 days ago)
- Language: Ruby
- Homepage:
- Size: 1.42 MB
- Stars: 6,879
- Watchers: 163
- Forks: 436
- Open Issues: 71
- Releases: 44
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
README.md
Better Errors
Better Errors replaces the standard Rails error page with a much better and more useful error page. It is also usable outside of Rails in any Rack app as Rack middleware.

Features
For screenshots of these features, see the wiki.
- Full stack trace
- Source code inspection for all stack frames (with highlighting)
- Local and instance variable inspection
- Live shell (REPL) on every stack frame
- Links directly to the source line in your editor
- Useful information in non-HTML requests
Installation
Add this to your Gemfile:
group :development do
gem "better_errors"
gem "binding_of_caller"
end
binding_of_caller is optional, but is necessary to use Better Errors' advanced features (REPL, local/instance variable inspection, pretty stack frame names).
Note: If you discover that Better Errors isn't working - particularly after upgrading from version 0.5.0 or less - be sure to set config.consider_all_requests_local = true in config/environments/development.rb.
Optional: Set EDITOR
For many reasons outside of Better Errors, you should have the EDITOR environment variable set to your preferred
editor.
Better Errors, like many other tools, will use that environment variable to show a link that opens your
editor to the file and line from the console.
By default the links will open TextMate-protocol links.
To see if your editor is supported or to set up a different editor, see the wiki.
Optional: Set BETTER_ERRORS_INSIDE_FRAME
If your application is running inside of an iframe, or if you have a Content Security Policy that disallows links
to other protocols, the editor links will not work.
To work around this set BETTER_ERRORS_INSIDE_FRAME=1 in the environment, and the links will include target=_blank,
allowing the link to open regardless of the policy.
This works because it opens the editor from a new browser tab, escaping from the restrictions of your site.
Unfortunately it leaves behind an empty tab each time, so only use this if needed.
Security
NOTE: It is critical you put better_errors only in the development section of your Gemfile.
Do NOT run better_errors in production, or on Internet-facing hosts.
You will notice that the only machine that gets the Better Errors page is localhost, which means you get the default error page if you are developing on a remote host (or a virtually remote host, such as a Vagrant box).
Obviously, the REPL is not something you want to expose to the public, and there may be sensitive information available in the backtrace.
For more information on how to configure access, see the wiki.
Usage
If you're using Rails, there's nothing else you need to do.
Using without Rails.
If you're not using Rails, you need to insert BetterErrors::Middleware into your middleware stack, and optionally set BetterErrors.application_root if you'd like Better Errors to abbreviate filenames within your application.
For instructions for your specific middleware, see the wiki.
Plain text requests
Better Errors will render a plain text error page when the request is an
XMLHttpRequest or when the Accept header does not include 'html'.
Unicorn, Puma, and other multi-worker servers
Better Errors works by leaving a lot of context in server process memory.
If you're using a web server that runs multiple "workers" it's likely that a second
request (as happens when you click on a stack frame) will hit a different
worker.
That worker won't have the necessary context in memory, and you'll see
a Session Expired message.
If this is the case for you, consider turning the number of workers to one (1)
in development. Another option would be to use Webrick, Mongrel, Thin,
or another single-process server as your rails server, when you are trying
to troubleshoot an issue in development.
Changing the link to your editor
Better Errors includes a link to your editor for the file and line of code that is being shown.
By default, it uses your environment to determine which editor should be opened.
See the wiki for instructions on configuring the editor.
Set maximum variable size for inspector.
# e.g. in config/initializers/better_errors.rb
# This will stop BetterErrors from trying to render larger objects, which can cause
# slow loading times and browser performance problems. Stated size is in characters and refers
# to the length of #inspect's payload for the given object. Please be aware that HTML escaping
# modifies the size of this payload so setting this limit too precisely is not recommended.
# default value: 100_000
BetterErrors.maximum_variable_inspect_size = 100_000
Ignore inspection of variables with certain classes.
# e.g. in config/initializers/better_errors.rb
# This will stop BetterErrors from trying to inspect objects of these classes, which can cause
# slow loading times and unnecessary database queries. Does not check inheritance chain, use
# strings not constants.
# default value: ['ActionDispatch::Request', 'ActionDispatch::Response']
BetterErrors.ignored_classes = ['ActionDispatch::Request', 'ActionDispatch::Response']
Get in touch!
If you're using better_errors, I'd love to hear from you. Drop me a line and tell me what you think!
Development
After checking out the repo, run bundle install to install the basic dependencies.
You can run the tests with the simplest set of dependencies using:
bundle exec rspec
To run specs for each of the dependency combinations, run:
bundle exec rake test:all
You can run specs for a specific dependency combination using:
BUNDLE_GEMFILE=gemfiles/pry09.gemfile bundle exec rspec
On CI, the specs are run against each gemfile on each supported version of Ruby.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Owner metadata
- Name: Better Errors
- Login: BetterErrors
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/42681592?v=4
- Repositories: 5
- Last ynced at: 2024-03-26T22:08:44.754Z
- Profile URL: https://github.com/BetterErrors
GitHub Events
Total
- Pull request event: 1
- Fork event: 9
- Issues event: 11
- Watch event: 53
- Issue comment event: 10
- Gollum event: 1
- Pull request review event: 2
- Pull request review comment event: 2
Last Year
- Fork event: 6
- Issues event: 8
- Watch event: 26
- Issue comment event: 3
- Gollum event: 1
Committers metadata
Last synced: 6 days ago
Total Commits: 585
Total Committers: 95
Avg Commits per committer: 6.158
Development Distribution Score (DDS): 0.609
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Charlie Somerville | c****e@c****m | 229 |
| Robin Daugherty | r****n@r****t | 166 |
| Rico Sta. Cruz | r****o@a****m | 35 |
| Ryan McGeary | r****n@m****g | 7 |
| Hailey Somerville | h****y@h****l | 6 |
| Benjamin Quorning | b****n@q****t | 6 |
| Philip | p****p@m****t | 5 |
| Bob Breznak | b****k@g****m | 4 |
| Roma Milushov | r****a@m****u | 4 |
| antn | a****n@a****e | 4 |
| ☈king | r****g@s****g | 4 |
| Charlie Somerville | c****e@c****z | 4 |
| Aidan Feldman | a****n@g****v | 3 |
| Cory Fabre | c****b@g****m | 3 |
| Felix Bünemann | f****n@g****m | 3 |
| Hrvoje Šimić | s****c@g****m | 3 |
| Igor Victor | g****a@y****u | 3 |
| Milo Winningham | m****o@w****t | 3 |
| Romain Tribes | t****n@g****m | 3 |
| Simon Eskildsen | s****p@s****m | 2 |
| Rafael Nunes | r****s@g****m | 2 |
| Paul Dobbins | p****s@i****m | 2 |
| Maxim Chernyak aka hakunin | m****r@g****m | 2 |
| Kostiantyn Kahanskyi | k****i@g****m | 2 |
| Kadu Diógenes | k****u@f****r | 2 |
| Jarrod Robins | j****d@j****m | 2 |
| James Smith | j****s@l****m | 2 |
| Fred Wu | i****u@g****m | 2 |
| Chad Humphries | c****s@g****m | 2 |
| Akira Matsuda | r****e@d****p | 2 |
| and 65 more... | ||
Committer domains:
- mikian.com: 1
- mac.com: 1
- ballgag.cz: 1
- jetbuilt.com: 1
- leafly.com: 1
- picandocodigo.net: 1
- unabridgedsoftware.com: 1
- porkrind.org: 1
- me.com: 1
- brynary.com: 1
- nleger.com: 1
- jomo.tv: 1
- 163.com: 1
- fusic.co.jp: 1
- gmualumni.org: 1
- thomet.de: 1
- teoljungberg.com: 1
- 4eb.de: 1
- sj26.com: 1
- salimane.com: 1
- arndt.io: 1
- braingourmets.com: 1
- auxbuss.com: 1
- plataformatec.com.br: 1
- audioboo.fm: 1
- thoughtbot.com: 1
- civisanalytics.com: 1
- nutsonline.com: 1
- keysetts.com: 1
- member.fsf.org: 1
- opploans.com: 1
- virusman.ru: 1
- envato.com: 1
- dio.jp: 1
- loopj.com: 1
- jarrodrobins.com: 1
- fnix.com.br: 1
- sirupsen.com: 1
- winningham.net: 1
- yandex.ru: 1
- gsa.gov: 1
- charlie.bz: 1
- sharpsaw.org: 1
- antn.me: 1
- milushov.ru: 1
- mixxt.net: 1
- quorning.net: 1
- hailey.lol: 1
- mcgeary.org: 1
- ambiescent.com: 1
- robindaugherty.net: 1
- charliesomerville.com: 1
Issue and Pull Request metadata
Last synced: 2 days ago
Total issues: 63
Total pull requests: 64
Average time to close issues: 11 months
Average time to close pull requests: 9 months
Total issue authors: 55
Total pull request authors: 37
Average comments per issue: 3.57
Average comments per pull request: 2.05
Merged pull request: 35
Bot issues: 0
Bot pull requests: 0
Past year issues: 9
Past year pull requests: 1
Past year average time to close issues: about 1 month
Past year average time to close pull requests: N/A
Past year issue authors: 8
Past year pull request authors: 1
Past year average comments per issue: 0.56
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- RobinDaugherty (5)
- elalemanyo (3)
- manuelmeurer (2)
- odilucas86-cpu (2)
- Rigo102 (1)
- coezbek (1)
- olimart (1)
- DannyBen (1)
- no1-knows (1)
- AlexWayfer (1)
- jeffdlange (1)
- bb (1)
- armstrca (1)
- brendon (1)
- miguno (1)
Top Pull Request Authors
- RobinDaugherty (22)
- felixbuenemann (3)
- Otterpocket (2)
- jackjennings (2)
- coezbek (2)
- deikka (2)
- JoshCheek (1)
- olleolleolle (1)
- ryoqun (1)
- addisonmartin (1)
- sagarbommidi (1)
- purintai (1)
- srachner (1)
- goulvench (1)
- lastobelus (1)
Top Issue Labels
- enhancement (6)
- good first issue (2)
- bug (1)
Top Pull Request Labels
- enhancement (4)
- feature (1)
Package metadata
- Total packages: 4
-
Total downloads:
- rubygems: 201,525,823 total
- Total docker downloads: 932,779,284
- Total dependent packages: 136 (may contain duplicates)
- Total dependent repositories: 67,968 (may contain duplicates)
- Total versions: 170
- Total maintainers: 2
- Total advisories: 1
gem.coop: better_errors
Provides a better error page for Rails and other Rack apps. Includes source code inspection, a live REPL and local/instance variable inspection for all stack frames.
- Homepage: https://github.com/BetterErrors/better_errors
- Documentation: http://www.rubydoc.info/gems/better_errors/
- Licenses: MIT
- Latest release: 2.10.1 (published over 2 years ago)
- Last Synced: 2026-03-01T06:04:05.339Z (3 days ago)
- Versions: 44
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 100,760,648 Total
- Docker Downloads: 466,389,642
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.084%
- Downloads: 0.253%
- Maintainers (2)
rubygems.org: better_errors
Provides a better error page for Rails and other Rack apps. Includes source code inspection, a live REPL and local/instance variable inspection for all stack frames.
- Homepage: https://github.com/BetterErrors/better_errors
- Documentation: http://www.rubydoc.info/gems/better_errors/
- Licenses: MIT
- Latest release: 2.10.1 (published over 2 years ago)
- Last Synced: 2026-03-01T14:01:40.720Z (2 days ago)
- Versions: 44
- Dependent Packages: 136
- Dependent Repositories: 67,968
- Downloads: 100,765,175 Total
- Docker Downloads: 466,389,642
-
Rankings:
- Dependent repos count: 0.139%
- Stargazers count: 0.169%
- Downloads: 0.232%
- Dependent packages count: 0.253%
- Docker downloads count: 0.295%
- Average: 0.393%
- Forks count: 1.269%
- Maintainers (2)
- Advisories:
proxy.golang.org: github.com/bettererrors/better_errors
- Homepage:
- Documentation: https://pkg.go.dev/github.com/bettererrors/better_errors#section-documentation
- Licenses: mit
- Latest release: v2.10.1+incompatible (published over 2 years ago)
- Last Synced: 2026-02-27T20:38:20.388Z (4 days ago)
- Versions: 41
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
proxy.golang.org: github.com/BetterErrors/better_errors
- Homepage:
- Documentation: https://pkg.go.dev/github.com/BetterErrors/better_errors#section-documentation
- Licenses: mit
- Latest release: v2.10.1+incompatible (published over 2 years ago)
- Last Synced: 2026-02-27T20:38:20.293Z (4 days ago)
- Versions: 41
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
Dependencies
- gem-release >= 0
- simplecov >= 0
- simplecov-lcov >= 0
- rake ~> 10.0 development
- rspec ~> 3.5 development
- rspec-html-matchers >= 0 development
- rspec-its >= 0 development
- sassc >= 0 development
- yard >= 0 development
- erubi >= 1.0.0
- rack >= 0.9.0
- rouge >= 1.0.0
- actions/cache v2 composite
- actions/checkout v2 composite
- coverallsapp/github-action v1.1.2 composite
- ruby/setup-ruby v1 composite
- release-drafter/release-drafter v5 composite
- release-drafter/release-drafter v5 composite
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/upload-release-asset v1 composite
- bruceadams/get-release v1.2.2 composite
- ruby/setup-ruby v1 composite
Score: 34.249720676044845