Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow custom favicon #362

Open
psimyn opened this issue Mar 8, 2017 · 4 comments
Open

allow custom favicon #362

psimyn opened this issue Mar 8, 2017 · 4 comments

Comments

@psimyn
Copy link

psimyn commented Mar 8, 2017

we have some pages that use a different favicon (or non .ico icons)

I think custom path might be the way to go, since that favicon caches are super long

Many thanks for such great errors

@RobinDaugherty
Copy link
Member

Can you explain the purpose of supporting favicons? Since this is a development-only tool, it doesn't seem like that would be useful.

@psimyn
Copy link
Author

psimyn commented Aug 1, 2017

We currently use different coloured favicons for dev vs prod environments. Helps distinguish which window is which when there are many tabs open. This shows production (left), tab with error, and tab with dev favicon. Ideally the one in the middle should be green

screen shot 2017-08-01 at 10 36 56 am

@RobinDaugherty RobinDaugherty added this to the v3.0 milestone Aug 1, 2017
@RobinDaugherty
Copy link
Member

RobinDaugherty commented Aug 1, 2017

Okay, I can see the value in it being obvious whether you are on production 😬. It seems an edge case, but it also seems like an easy thing to add. Perhaps the default icon should be some kind of Better Errors icon.

@coezbek
Copy link

coezbek commented Mar 28, 2024

I just wanted to see my usual favicon for the app so I can find the browser tab, so I did the following to to override the main.erb template in an initializer:

module BetterErrors
  # @private
  class ErrorPage
    class <<self
      alias_method :original_template_path, :template_path
    end

    def self.template_path(template_name)
      if template_name == "main"
        File.expand_path("../../../lib/better_errors/templates/#{template_name}.erb", __FILE__)
      else
        original_template_path(template_name) 
      end
    end
  end
end

The template I just overrode in place of the favicon (and saved in lib/better_errors/templates/main.erb):

<!DOCTYPE html>
<html>
<head>
    <title><%= exception_type %> at <%= request_path %></title>
    <link rel="icon" type="image/png" href="/favicon.png">
</head>
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants