You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an error occurs in a Pilet's setup function, it should be caught by a wrapping try-catch.
The setup function of a Pilet is allowed to be synchronous or asynchronous. The try-catch catches errors that occur in a synchronous setup function. However, the error slips past the try-catch when it occurs in an async Setup function. The error hits the ErrorBoundary, and because the AppShell is still initializing, it treats it as a LoadingError, when bricks the entire site.
Steps to Reproduce
Successfully caught error for synchronous setup function:
export function setup(app: PiletApi) { throw new Error("Setup error"); }
Error while setting up cx-uex-shell-sandbox-pilet. Error: Setup error
at Object.setup (:1234/$pilet-api/0/index.js?updated=1645095925729:133:9)
at setupSinglePilet (index.35df86.js:97989:28)
at setupPilet (index.35df86.js:98032:16)
at createPilets (index.35df86.js:97384:84)
at evalAll (index.35df86.js:98073:79)
at index.35df86.js:98143:31
Uncaught error for asynchronous setup function:
export async function setup(app: PiletApi) { throw new Error("Setup error"); }
[dev-info] An error occurred in the Piral instance. {type: 'loading', error: Error: Setup error
Expected behavior
Errors in async setup functions should be caught, preventing the Shell from entering a LoadingError state.
Actual behavior
Error is not caught, and Shell enters a LoadingError state.
Possible Origin / Solution
In src/framework/piral-base/src/setup.ts:
setupSinglePilet does not await app.setup(api).
Try-catch is exited before error occurs.
The text was updated successfully, but these errors were encountered:
Bug Report
For more information, see the
CONTRIBUTING
guide.Prerequisites
Environment Details and Version
Package: piral-core@0.14.10
Description
When an error occurs in a Pilet's setup function, it should be caught by a wrapping try-catch.
The setup function of a Pilet is allowed to be synchronous or asynchronous. The try-catch catches errors that occur in a synchronous setup function. However, the error slips past the try-catch when it occurs in an async Setup function. The error hits the ErrorBoundary, and because the AppShell is still initializing, it treats it as a LoadingError, when bricks the entire site.
Steps to Reproduce
Successfully caught error for synchronous setup function:
export function setup(app: PiletApi) { throw new Error("Setup error"); }
Error while setting up cx-uex-shell-sandbox-pilet. Error: Setup error
at Object.setup (:1234/$pilet-api/0/index.js?updated=1645095925729:133:9)
at setupSinglePilet (index.35df86.js:97989:28)
at setupPilet (index.35df86.js:98032:16)
at createPilets (index.35df86.js:97384:84)
at evalAll (index.35df86.js:98073:79)
at index.35df86.js:98143:31
Uncaught error for asynchronous setup function:
export async function setup(app: PiletApi) { throw new Error("Setup error"); }
[dev-info] An error occurred in the Piral instance. {type: 'loading', error: Error: Setup error
Expected behavior
Errors in async setup functions should be caught, preventing the Shell from entering a LoadingError state.
Actual behavior
Error is not caught, and Shell enters a LoadingError state.
Possible Origin / Solution
In src/framework/piral-base/src/setup.ts:
setupSinglePilet does not await app.setup(api).
Try-catch is exited before error occurs.
The text was updated successfully, but these errors were encountered: