-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
chore: improve type fidelity for internal error class #9478
Conversation
🦋 Changeset detectedLatest commit: 7470d29 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/astro/src/content/utils.ts
Outdated
@@ -492,7 +492,7 @@ export async function getEntrySlug({ | |||
contents = await fs.promises.readFile(fileUrl, 'utf-8'); | |||
} catch (e) { | |||
// File contents should exist. Raise unexpected error as "unknown" if not. | |||
throw new AstroError(AstroErrorData.UnknownContentCollectionError, { cause: e }); |
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 still don't understand why the second argument is undefined
🤔
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.
That is the message.
const error = new Error("error message", { cause })
AstroError's constructor overrides the message (this.message = errorData.message
) anyway so it might be possible to remove the option altogether.
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 was a bit worried but it was relatively simple.
@@ -226,7 +226,6 @@ export async function generateImagesForPath( | |||
...AstroErrorData.CouldNotTransformImage, | |||
message: AstroErrorData.CouldNotTransformImage.message(originalFilePath), | |||
}, | |||
undefined, |
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.
how did tsc miss this?
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.
oh its from 9352
e7eef4e
to
7470d29
Compare
Changes
Testing
None as this is a maintainer QOL change mostly.
Docs
Does not affect usage.