GithubHelp home page GithubHelp logo

linjunpop / better_errors Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bettererrors/better_errors

0.0 3.0 0.0 192 KB

Better error page for Rails and other Rack apps

License: MIT License

Ruby 100.00%

better_errors's Introduction

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.

image

Features

  • Full stack trace
  • Source code inspection for all stack frames (with highlighting)
  • Local and instance variable inspection
  • Live REPL on every stack frame

Installation

Add this to your Gemfile:

group :development do
  gem "better_errors"
end

NOTE: It is critical you put better_errors in the development section. Do NOT run better_errors in production, or on Internet facing hosts.

If you would like to use Better Errors' advanced features (REPL, local/instance variable inspection, pretty stack frame names), you need to add the binding_of_caller gem by @banisterfiend to your Gemfile:

gem "binding_of_caller"

This is an optional dependency however, and Better Errors will work without it.

Usage

If you're using Rails, there's nothing else you need to do.

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.

Here's an example using Sinatra:

require "sinatra"
require "better_errors"

configure :development do
  use BetterErrors::Middleware
  BetterErrors.application_root = File.expand_path("..", __FILE__)
end

get "/" do
  raise "oops"
end

Compatibility

  • Supported
    • MRI 1.9.2, 1.9.3
    • JRuby (1.9 mode) - advanced features unsupported
    • Rubinius (1.9 mode) - advanced features unsupported
  • Coming soon
    • MRI 2.0.0 - the official API for grabbing caller bindings is slated for MRI 2.0.0, but it has not been implemented yet

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!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

better_errors's People

Contributors

betawaffle avatar caldwell avatar conradirwin avatar csexton avatar haileys avatar i3zhe avatar jarrodrobins avatar loopj avatar lucascaton avatar mikian avatar ndbroadbent avatar picandocodigo avatar qqshfox avatar quadule avatar rstacruz avatar shime avatar simi avatar virusman avatar zhouguangming avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.