Skip to content

Introduce model error handling#334

Open
bohdanprog wants to merge 3 commits intomargelo:mainfrom
bohdanprog:introduce-model-error-handling
Open

Introduce model error handling#334
bohdanprog wants to merge 3 commits intomargelo:mainfrom
bohdanprog:introduce-model-error-handling

Conversation

@bohdanprog
Copy link

Fix #281.

Problem:
Previously, useBuffer silently swallowed load errors (only console.error), and useModel had no way to surface them to the caller. This made it impossible to show error UI or recover gracefully when a model fails to load.

Changes:
Add UseBufferResult interface to useBuffer returning { buffer, error } instead of FilamentBuffer | undefined
Add error state to FilamentModel type
Propagate buffer load errors through useModel as { state: 'error', error }
Update all useBuffer call sites to destructure the new return shape

Testing:
Run the new ModelErrorHandling example in examples/Shared/src/ModelErrorHandling.tsx. It intentionally loads from an invalid URL — you should see the error message rendered instead of a blank screen.

@bohdanprog
Copy link
Author

Hey, @hannojg @mrousavy, could you take a look at my PR? It's JS-only changes that add error state propagation to useModel — so callers can now handle load failures gracefully instead of silently swallowing them.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Error Handling - UseModel()

1 participant