Sha256: dfa5bce0d803746977c491acc0d009944ff036b83dbf30306489387539ba798a
Contents?: true
Size: 746 Bytes
Versions: 2
Compression:
Stored size: 746 Bytes
Contents
class DevelopmentModePlugin def after_response(current_response, _) current_response.each do |name, result| current_response[name] = result.merge({ "html" => render(name, result) }) if result["error"] end end private def render(name, result) <<-HTML <div style="background-color: #ff5a5f; color: #fff; padding: 12px;"> <p style="margin: 0"> <strong>Development Warning!</strong> The <code>#{name}</code> component failed to render with Hypernova. Error stack: </p> <ul style="padding: 0 20px"> <li>#{stack_trace(result).join("</li><li>")}</li> </ul> </div> HTML end def stack_trace(result) result["error"]["stack"] || [] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hypernova-1.0.1 | lib/hypernova/plugins/development_mode_plugin.rb |
hypernova-1.0.0 | lib/hypernova/plugins/development_mode_plugin.rb |