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

The DIV generated by the top level component error handler should have a class #308

Open
catmando opened this issue May 14, 2020 · 0 comments
Open

Comments

@catmando
Copy link
Contributor

@catmando catmando commented May 14, 2020

In order easily style the top level component error handler back stop it should have a class (like ''hyperstack-top-level-error-boundry' that you can set the CSS for.

I.e. make the text smaller, and give it a white background, etc.

Here is a patch:

module Hyperstack
  class Hotloader
    module AddErrorBoundry
      # don't attempt the alias unless the method is defined.
      # for example if HotLoader is not included in the stack
      alias original_display_error display_error if method_defined? :display_error
      def display_error(*args)
        DIV(class: 'hyperstack-top-level-error-boundry') { original_display_error(*args) }
      end
    end
  end
end

Be sure to have the method_defined? guard defined, otherwise you may discover in test or worse in production things won't boot

@catmando catmando added this to To do in ALPHA to production via automation May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.