-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(live loaders): rename functions and add error handling #13846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
819928f to
f2f50f3
Compare
| const parsed = await schema.safeParseAsync(entry.data); | ||
| if (!parsed.success) { | ||
| return { | ||
| error: new AstroError({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this should return an astro error. We usually keep these to be thrown, not to be used by users. What about a new LiveLoaderError type, like actions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
Changes
Changes the live loader API to use different functions for querying:
getLiveEntryandgetLiveCollection. Also adds explicit error handling: a loader or a query can return either data or an error.Testing
Updated existing tests and added new test for error handling
Docs