Class: Charming::Components::ErrorScreen
- Inherits:
-
Charming::Component
- Object
- View
- Charming::Component
- Charming::Components::ErrorScreen
- Defined in:
- lib/charming/presentation/components/error_screen.rb
Overview
ErrorScreen renders an unhandled exception as a styled, centered panel instead of letting the backtrace crash into the raw terminal. Shows the exception class, message, the most relevant backtrace lines, and a dismiss hint. The Runtime displays it when a dispatched action raises and no ‘rescue_from` handler claimed the exception.
Constant Summary collapse
- DEFAULT_WIDTH =
64- BACKTRACE_LINES =
6
Instance Method Summary collapse
-
#initialize(error:, width: DEFAULT_WIDTH, root: Dir.pwd, theme: nil) ⇒ ErrorScreen
constructor
error is the rescued exception.
-
#render ⇒ Object
Renders the bordered error panel.
Methods inherited from Charming::Component
Methods inherited from View
Constructor Details
#initialize(error:, width: DEFAULT_WIDTH, root: Dir.pwd, theme: nil) ⇒ ErrorScreen
error is the rescued exception. width is the panel’s total width. root is the app root used to shorten backtrace paths (defaults to the working directory).
15 16 17 18 19 20 |
# File 'lib/charming/presentation/components/error_screen.rb', line 15 def initialize(error:, width: DEFAULT_WIDTH, root: Dir.pwd, theme: nil) super(theme: theme) @error = error @width = width @root = root end |
Instance Method Details
#render ⇒ Object
Renders the bordered error panel.
23 24 25 |
# File 'lib/charming/presentation/components/error_screen.rb', line 23 def render box(column(*sections, gap: 1), style: panel_style) end |