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

Raise an exception (in development), if an icon does not exist. #40

Open
tmaier opened this issue Jun 28, 2023 · 0 comments
Open

Raise an exception (in development), if an icon does not exist. #40

tmaier opened this issue Jun 28, 2023 · 0 comments

Comments

@tmaier
Copy link
Contributor

tmaier commented Jun 28, 2023

Heroicon warns via a console message, if an icon does not exist. This is too subtle for me. I want it to scream into my face while I am in development, test and maybe also in the staging environment.

I solved this with a monkey patch. However, I would prefer to be able to configure this.

# Monkey patch to raise an error if the icon does not exist
class Heroicon::Icon
  def warning
    return unless Rails.env.development? || Rails.env.test?

    raise ArgumentError, "The icon '#{name}' does not exist."
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant