-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat: break down AstroDataError
in multiple objects
#7919
Conversation
|
0f2315f
to
48e84a6
Compare
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.
Code looks good, unfortunate that this is needed, but I understand why ESBuild cannot tree shaking unused properties of objects safely.
Don't forget to update the README.md in the src/core/errors
folder with the new name
property!
48e84a6
to
ea426bd
Compare
ea426bd
to
46974b6
Compare
throw new AstroError({ | ||
name: 'ContentImportsPluginError', | ||
message: 'Unexpected error processing content collection data.', | ||
}); |
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'll note that this should be a defined error in error-data with perhaps common causes and stuff. But something to see in another PR perhaps.
The only time where throwing an AstroError that is not defined is ok is if the error is temporary (ex: experimental feature has not been enabled).
Closing in favour of #7949 |
Changes
This PR removes the
AstroDataError
object and instead defines each error as an exported object.Few things I had to change to adapt some logic:
"name"
property, which is essentially the name of the error itself;name
is now mandatory, so somecreate*error
factory functions add that"name"
. It's a bit redundant;import * as AstroErrorData
. I tested locally with a project, and it still works;Testing
Docs
I didn't add a changelog because this is an internal refactor. Should I create a changelog?