jaspr icon indicating copy to clipboard operation
jaspr copied to clipboard

fix: Jaspr does not properly return a 500 error when an error occurs durring rendering

Open fuzzybinary opened this issue 2 years ago • 1 comments

Description

If a widget throws an exception during rendering (for example during preloadState) the exception is not bubbled up to shelf, and thus no response is sent to the browser, which looks in Firefox to just be an infinite load.

Steps To Reproduce

  • Create a Component that throws an exception during preloadState.
  • Load the page containing the component.

Doctor Output

[✓] Jaspr CLI (Version 0.9.2) • Dart Version 3.1.3 (stable) (Tue Sep 26 14:25:13 2023 +0000) on "windows_x64" at C:\Users\Jeff Ward\Projects\flutter\bin\cache\dart-sdk\bin\dart.exe • Running on windows "Windows 10 Home Single Language" 10.0 (Build 19045) - Locale en-US • Analytics: Enabled

[✓] Current Project • Dependencies on core packages: • jaspr: ^0.9.2 • jaspr_builder: ^0.9.2 (dev) • jaspr_router: ^0.3.0 • Uses server-side rendering: true • Uses experimental compilers: false • Uses flutter embedding: false

Expected Behavior

Server should properly return a 500 error.

Additional Context

This is because the Isolate.spawn does not automatically propagate error back to the calling isolate. I have a fix locally, and I'll work on getting a PR up in the next few days if you're open to it.

fuzzybinary avatar Oct 28 '23 04:10 fuzzybinary

Sry this one slipped through my radar. I'm happy to accept a PR for this, definitely important to do proper error handling.

schultek avatar Jan 09 '24 11:01 schultek