Sha256: 5cc1c6a6a9ffa170d133fad1cd62926ac3f30a6e18338c2efee5e1df3c6105ab

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

# Tips and Tricks

Below are a collection of handy tips and tricks submitted by users to help you get the most out of Better Errors.

If you know something you think would be valuable to share, please do! Pull requests are always appreciated.

### View last error

Better Errors saves the most recent error page displayed at `/__better_errors`.

This can be handy if you aren't able to see the error page served up when the exception occurred, eg. if the errored request was an AJAX or curl request.

### Adjusting the project base path for the editor link

If your Rails app is running from a shared folder in a VM, the path to your source files from Rails' perspective could be different to the path seen by your editor.

You can adjust the path used to generate open-in-editor links by putting this snippet of code in an initializer:

```ruby
if defined? BetterErrors
  BetterErrors.editor = proc { |full_path, line|
    full_path = full_path.sub(Rails.root.to_s, your_local_path)
    "my-editor://open?url=file://#{full_path}&line=#{line}"
  }
end
```

If you're working on a project with other developers, your base path may be not be the same as the other developers'.

You can use an environment variable to work around this by replacing `your_local_path` in the snippet above with `ENV["BETTER_ERRORS_PROJECT_PATH"]` and starting your Rails server like this:

```shell
$ BETTER_ERRORS_PROJECT_PATH=/path/to/your/app rails server
```

### Opening files in RubyMine

Users of RubyMine on OS X can follow the instructions provided at http://devnet.jetbrains.com/message/5477503 to configure Better Errors to open files in RubyMine.

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
better_errors-0.9.0 TIPS_AND_TRICKS.md
better_errors-0.8.0 TIPS_AND_TRICKS.md
better_errors-0.7.2 TIPS_AND_TRICKS.md
better_errors-0.7.0 TIPS_AND_TRICKS.md
better_errors-0.6.0 TIPS_AND_TRICKS.md