Exception: Sinatra::HaltResponse
- Inherits:
-
Exception
- Object
- Exception
- Sinatra::HaltResponse
- Defined in:
- lib/sinatra_opal_patches.rb
Overview
1.5. HaltResponse
‘throw :halt` cannot cross an async boundary in Opal: once a `# await: true` route has yielded to a Promise, the eventual throw resumes on a later tick and bypasses Sinatra’s outer ‘catch(:halt)`. We therefore represent explicit `halt` calls as an Exception carrying the fully-materialized Rack tuple. Synchronous routes still terminate immediately; async routes can resolve the rejection back into a response in `invoke` / `build_js_response`.
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
-
#initialize(payload) ⇒ HaltResponse
constructor
A new instance of HaltResponse.
Constructor Details
#initialize(payload) ⇒ HaltResponse
Returns a new instance of HaltResponse.
53 54 55 56 |
# File 'lib/sinatra_opal_patches.rb', line 53 def initialize(payload) @payload = payload super('halt') end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
51 52 53 |
# File 'lib/sinatra_opal_patches.rb', line 51 def payload @payload end |