blank project
This commit is contained in:
67
node_modules/astro/dist/content/loaders/errors.js
generated
vendored
Normal file
67
node_modules/astro/dist/content/loaders/errors.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
class LiveCollectionError extends Error {
|
||||
constructor(collection, message, cause) {
|
||||
super(message);
|
||||
this.collection = collection;
|
||||
this.message = message;
|
||||
this.cause = cause;
|
||||
this.name = "LiveCollectionError";
|
||||
if (cause?.stack) {
|
||||
this.stack = cause.stack;
|
||||
}
|
||||
}
|
||||
static is(error) {
|
||||
return error instanceof LiveCollectionError;
|
||||
}
|
||||
}
|
||||
class LiveEntryNotFoundError extends LiveCollectionError {
|
||||
constructor(collection, entryFilter) {
|
||||
super(
|
||||
collection,
|
||||
`Entry ${collection} \u2192 ${typeof entryFilter === "string" ? entryFilter : JSON.stringify(entryFilter)} was not found.`
|
||||
);
|
||||
this.name = "LiveEntryNotFoundError";
|
||||
}
|
||||
static is(error) {
|
||||
return error?.name === "LiveEntryNotFoundError";
|
||||
}
|
||||
}
|
||||
class LiveCollectionValidationError extends LiveCollectionError {
|
||||
constructor(collection, entryId, error) {
|
||||
super(
|
||||
collection,
|
||||
[
|
||||
`**${collection} \u2192 ${entryId}** data does not match the collection schema.
|
||||
`,
|
||||
...error.errors.map((zodError) => ` **${zodError.path.join(".")}**: ${zodError.message}`),
|
||||
""
|
||||
].join("\n")
|
||||
);
|
||||
this.name = "LiveCollectionValidationError";
|
||||
}
|
||||
static is(error) {
|
||||
return error?.name === "LiveCollectionValidationError";
|
||||
}
|
||||
}
|
||||
class LiveCollectionCacheHintError extends LiveCollectionError {
|
||||
constructor(collection, entryId, error) {
|
||||
super(
|
||||
collection,
|
||||
[
|
||||
`**${String(collection)}${entryId ? ` \u2192 ${String(entryId)}` : ""}** returned an invalid cache hint.
|
||||
`,
|
||||
...error.errors.map((zodError) => ` **${zodError.path.join(".")}**: ${zodError.message}`),
|
||||
""
|
||||
].join("\n")
|
||||
);
|
||||
this.name = "LiveCollectionCacheHintError";
|
||||
}
|
||||
static is(error) {
|
||||
return error?.name === "LiveCollectionCacheHintError";
|
||||
}
|
||||
}
|
||||
export {
|
||||
LiveCollectionCacheHintError,
|
||||
LiveCollectionError,
|
||||
LiveCollectionValidationError,
|
||||
LiveEntryNotFoundError
|
||||
};
|
||||
Reference in New Issue
Block a user