Skip to content

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

@tmaier

Description

@tmaier

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions